forked from Nipahh/message-move
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
37 lines (27 loc) · 963 Bytes
/
bot.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 Discord = require('discord.js')
const fs = require('fs')
const config = require('./config')
const client = new Discord.Client()
client.config = config
client.dversion = Discord.version
client.utils = require('./utilities')
// Taken from an idiot's guide
// Loading events
const eventFiles = fs.readdirSync('./events/').filter(file => file.endsWith('.js'))
eventFiles.forEach(file => {
const filename = `./events/${file}`
const eventName = file.split('.')[0]
const event = require(filename)
client.on(eventName, event.bind(null, client))
})
// Loading commands
client.commands = new Discord.Collection()
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'))
commandFiles.forEach(file => {
const filename = `./commands/${file}`
const command = require(filename)
const commandName = file.split('.')[0]
client.commands.set(commandName, command)
})
client.login(config.token)
delete client.config.token