-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
27 lines (23 loc) · 948 Bytes
/
main.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
const {client} = require('./modules/clientModule.js');
const handleMessage = require('./handlers/messageHandler.js');
const checkForUpdates = require('./modules/updateModule.js');
const {saveSubscriberQueue, saveViewerQueue} = require("./utils/queue");
const handleIDMessage = require("./handlers/smartHandler");
const modes = require('./modes.json');
const botConfig = require('./auth-config.json');
const {initializeWebModule} = require("./modules/webModule");
// Check for updates
checkForUpdates(client);
client.on('message', handleMessage(client));
if (modes.smart) { // if user has smart enabled
client.on('message', handleIDMessage(client));
}
// Save the queues to files when the bot is shut down
process.on('SIGINT', () => {
saveSubscriberQueue();
saveViewerQueue();
process.exit();
});
if (botConfig.WebAPIToken) { // if API token doesnt exist, don't start web module to avoid erroring out
initializeWebModule();
}