-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
37 lines (33 loc) · 1.04 KB
/
index.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
const Bot = require('slacky');
const WebClient = require('@slack/client').WebClient;
const whitelist = require('slacky-middleware-white-black-list').whitelist;
const startListen = require('./lib/listeners/start');
const inListen = require('./lib/listeners/in');
const stopListen = require('./lib/listeners/stop');
const outListen = require('./lib/listeners/out');
const winListen = require('./lib/listeners/win');
const helpListen = require('./lib/listeners/help');
const statsListen = require('./lib/listeners/stats');
const statListen = require('./lib/listeners/stat');
const statTeamsListen = require('./lib/listeners/stat-teams');
const token = process.env.SLACK_API_TOKEN || '';
module.exports = bot = new Bot(token);
bot.web = new WebClient(token);
bot.currentGames = {};
bot.maximum = 4;
bot.timeout = 10 * 60 * 1000;
// Add listeners
[
startListen,
inListen,
outListen,
stopListen,
winListen,
helpListen,
statListen,
statsListen,
statTeamsListen
].forEach((listener) => {
bot.listen(listener.matcher, listener.callback);
});
bot.start();