-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
34 lines (28 loc) · 868 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
const Discord = require('discord.js')
const client = new Discord.Client({
partials: ['MESSAGE', 'REACTION', 'USER']
})
const config = require('./config.json')
const {
readdirSync
} = require('fs')
client.commands = new Discord.Collection()
client.config = config
client.sb = new(require('enmap'))({
name: "starboard",
autoFetch: true,
fetchAll: true,
ensureProps: true
})
let evtFiles = readdirSync('./events').filter(c => c.endsWith('.js'))
evtFiles.forEach(file => {
const eventName = file.split(".")[0];
const event = require(`./events/${file}`);
client.on(eventName, event.bind(null, client));
});
let cmdFiles = readdirSync('./commands').filter(c => c.endsWith('.js'))
for (let file of cmdFiles) {
let command = require(`./commands/${file}`)
client.commands.set(command.name, command)
}
client.login(config.token)