forked from acm-mu/CyberTA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
67 lines (61 loc) · 1.5 KB
/
bot.js
File metadata and controls
67 lines (61 loc) · 1.5 KB
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
/* eslint-disable no-console */
const Discord = require('discord.js');
const client = new Discord.Client();
const officehours = require('./officehours');
client.on('ready', () => {
console.log('[CyberBot] CyberBot has finished loading, and is enabled!');
});
client.on('message', (message) => {
// Only listen in bot's channels
if (process.env.TA_CHANNEL !== message.channel.id
&& process.env.OFFICE_HOURS !== message.channel.id) {
return;
}
const args = message.content.split(' ');
const cmd = args[0].toLowerCase();
args.splice(0, 1);
switch (cmd) {
case '!ping':
case 'ping':
message.reply('Pong!');
break;
case 'next':
case '!next':
officehours.onNext(message, args);
break;
case '!leave':
officehours.onLeave(message);
break;
case '!clear':
officehours.onClear(message);
break;
case '!queue':
officehours.onQueue(message);
break;
case '!undo':
officehours.onUndo(message);
break;
case '!remove':
officehours.onRemove(message, args);
break;
case '!oof':
officehours.onOof(message);
break;
case '!online':
officehours.onOnline(message);
break;
case '!offline':
officehours.onOffline(message);
break;
case '!ready':
case 'ready':
officehours.onReady(message, args);
break;
case '!help':
officehours.onHelp(message);
break;
default:
break;
}
});
client.login(process.env.BOT_TOKEN);