-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (24 loc) · 923 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
30
const { Client, Collection, IntentsBitField } = require("discord.js");
const { token } = require("./config");
const { readdirSync } = require("fs");
const path = require("path");
const client = new Client({
intents: [IntentsBitField.Flags.MessageContent /* other discord intents */],
});
client.commands = new Collection();
const commands = [];
module.exports.commands = commands;
module.exports.client = client;
const commandFiles = readdirSync(path.join(__dirname, "commands")).filter(
(file) => file.endsWith(".js")
);
for (const file of commandFiles) {
const command = require(path.join(__dirname, "commands", file));
commands.push(command.data.toJSON());
client.commands.set(command.data.name, command);
}
const eventFiles = readdirSync(path.join(__dirname, "events")).filter((file) =>
file.endsWith(".js")
);
eventFiles.map((value) => require(path.join(__dirname, "events", value)));
client.login(token);