forked from AcktarOfficial/CloudServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (24 loc) · 774 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
const { Client, Collection } = require('discord.js');
const fs = require('fs');
const client = new Client();
const config = require('./config.json');
client.config = config;
fs.readdir('./events/', (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
const eventName = file.split('.')[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Collection();
fs.readdir('./commands/', (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith('.js')) return;
const props = require(`./commands/${file}`);
const commandName = file.split('.')[0];
client.commands.set(commandName, props);
});
});
client.login(config.token);