-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
88 lines (66 loc) · 1.54 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
require('dotenv').config();
const resolve = require('path').resolve;
const { connectToChat, exec } = require('./helpers');
async function main() {
const chatClient = await connectToChat('marcopg2');
const listener = chatClient.onPrivmsg((channel, user, rawMessage, msg) => {
console.log(rawMessage);
if (Number(rawMessage)) {
exec(resolve('./menus.py'), rawMessage);
}
const message = rawMessage.toLowerCase();
switch (message) {
// Movement interactions
case 'w':
exec(resolve('./move.py'), 'w');
break;
case 'a':
exec(resolve('./move.py'), 'a');
break;
case 's':
exec(resolve('./move.py'), 's');
break;
case 'd':
exec(resolve('./move.py'), 'd');
break;
case 'jump':
exec(resolve('./move.py'), 'space');
break;
// Mouse interactions
case 'hit':
exec(resolve('./mouse.py'), 'hit');
break;
case 'destroy':
exec(resolve('./mouse.py'), 'destroy');
break;
case 'stop':
exec(resolve('./mouse.py'), 'stop');
break;
case 'inter':
exec(resolve('./mouse.py'), 'inter');
break;
case 'm.rigth':
exec(resolve('./mouse.py'), 'rigth');
break;
case 'm.left':
exec(resolve('./mouse.py'), 'left');
break;
case 'm.up':
exec(resolve('./mouse.py'), 'up');
break;
case 'm.down':
exec(resolve('./mouse.py'), 'down');
break;
// Menus interactions
case 'q':
exec(resolve('./menus.py'), 'q');
break;
case 'e':
exec(resolve('./menus.py'), 'e');
break;
default:
break;
}
});
}
main();