-
Notifications
You must be signed in to change notification settings - Fork 3
/
bot.js
35 lines (29 loc) · 912 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
const { Client } = require("discord.js");
const { token } = require("./Configuration/auth.js");
const config = require("./Configuration/config.js");
const { readdir } = require("fs/promises");
const client = new Client({ disableEveryone: "all" });
(async() => {
const constants = {
config,
client,
startupTime: new Date(),
commands: [],
};
let commands = await readdir("./Commands");
for (let i of commands) {
if (!i.endsWith(".js")) continue;
const info = require(`./Commands/${i}`).info;
if (!info.aliases) info.aliases = [];
info.aliases.push(i.replace(".js", ""));
info.filename = i;
constants.commands.push(info);
}
let events = await readdir("./Events");
for (let i of events) {
if (!i.endsWith(".js")) continue;
let eventName = i.replace(".js", "");
client.on(eventName, async(...args) => require(`./Events/${i}`)(constants, ...args));
}
})();
client.login(token);