-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
33 lines (26 loc) · 935 Bytes
/
bot.js
File metadata and controls
33 lines (26 loc) · 935 Bytes
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
const Discord = require('discord.js');
const client = new Discord.Client();
const Enmap = require("enmap");
const fs = require("fs");
const { general } = require('./config.js');
client.config = general;
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Enmap();
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
console.log(`Attempting to load command ${commandName}. Shard ID: ${(client.shard.id + 1)}/${client.shard.count}`);
client.commands.set(commandName, props);
});
});
client.login(general.token);