-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
38 lines (29 loc) · 881 Bytes
/
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
38
const fs = require('fs');
const Eris = require('eris');
const config = require('./config.json');
const bot = new Eris(`Bot ${config.token}`, {
allowedMentions: {
everyone: false,
roles: true,
users: true
},
getAllUsers: true,
restMode: true,
intents: 771
});
bot.config = config;
bot.commands = {};
fs.readdirSync('./commands/').forEach(f => {
if (f.startsWith('.')) return;
delete require.cache[require.resolve(`./commands/${f}`)];
let props = require(`./commands/${f}`);
bot.commands[props.help.name] = props;
});
fs.readdirSync('./events/').forEach(f => {
if (f.startsWith('.')) return;
delete require.cache[require.resolve(`./events/${f}`)];
let props = require(`./events/${f}`);
bot.removeAllListeners(f.split('.')[0]);
bot.on(f.split('.')[0], props.bind(null, bot));
});
bot.connect();