-
Notifications
You must be signed in to change notification settings - Fork 0
/
aoi.js
45 lines (37 loc) · 1.08 KB
/
aoi.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
let opts,
users = null;
exports.load = platform => {
users = require('./src/users.js')(exports.config);
opts = {
'register': require('./src/commands/register.js')(users),
//'unregister': require('./src/commands/unregister.js')(users),
'help': require('./src/commands/help.js')()
};
for (let opt in opts) {
if (opt.load) {
opt.load();
}
}
};
exports.unload = () => {
// Unload each submodule
for (let opt in opts) {
if (opt.unload) {
opt.unload();
}
}
users = null;
};
// listen on all text sent, to the module.
// TODO future module for text parsing
exports.match = () => {return true};
exports.run = (api, event) => {
const commands = event.arguments;
let command = null;
if (commands[0] === api.commandPrefix + 'aoi' && commands[1] && opts[commands[1].toLowerCase()]) {
command = commands[1].toLowerCase();
commands.splice(0, 2);
opts[command].run(commands, api, event, opts);
}
// send through to some intelligent module later
};