-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
26 lines (22 loc) · 989 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
const { Client, Collection, GatewayIntentBits } = require("discord.js");
const { TOKEN } = require("./config.json");
const fs = require("fs");
const path = require("path");
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers] });
client.commands = new Collection();
const eventFiles = fs.readdirSync(path.join(__dirname, "events"));
for (const eventFile of eventFiles) {
const event = require(path.join(__dirname, `events/${eventFile}`));
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
const commandFiles = fs.readdirSync(path.join(__dirname, "commands"));
for (const commandFile of commandFiles) {
const command = require(path.join(__dirname, `commands/${commandFile}`));
client.commands.set(command.data.name, command);
console.log(`[CRP-Console]: ${command.data.name} has been loaded.`);
}
client.login(TOKEN);