-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
33 lines (27 loc) · 910 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
require("dotenv").config();
const Discord = require("discord.js");
const fs = require("fs");
const client = new Discord.Client();
client.config = require("./config");
client.playing = new Set();
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.map(file => {
let event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Discord.Collection();
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
console.log("[Commands] hjönking...");
files.map(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
console.log(`[Commands] hjönked ${file}`);
client.commands.set(props.help.name, props);
});
console.log(`[Commands] hjönked ${files.length} commands!`);
});
client.login(client.config.token);