-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
25 lines (20 loc) · 876 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
const dotenv = require("dotenv").config();
const fs = require("fs");
const Discord = require("discord.js");
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const { Client, GatewayIntentBits, Partials } = Discord;
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.MessageContent],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
client.commands = new Discord.Collection();
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
}
else {
client.on(event.name, (...args) => event.execute(...args));
}
}
client.login(dotenv.parsed.BOT_TOKEN);