-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
26 lines (21 loc) · 842 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
// Require the necessary discord.js classes
const { Client, Intents, Collection } = require("discord.js");
const fs = require("fs");
const { token } = require("config");
// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.commands = new Collection();
// functions events commands
const functions = fs.readdirSync("./functions").filter((file) => file.endsWith(".js"));
const events = fs.readdirSync("./events").filter((file) => file.endsWith(".js"));
const commands = fs.readdirSync("./commands");
(() => {
// create handleCommands and handleEvents
for (file of functions) {
require(`./functions/${file}`)(client);
}
// Make Bot Online
client.handleEvents(events, "./events");
client.handleCommands(commands, "./commands");
client.login(token);
})();