-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (26 loc) · 921 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 { GatewayIntentBits, Client, Partials,} = require('discord.js');
const fs = require('node:fs');
const dotenv = require('dotenv');
dotenv.config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildEmojisAndStickers,
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
client.on('ready', async () => {
console.log(`Logged in as ${client.user.tag}!`);
});
// Retrieve all event files
const eventFiles = fs.readdirSync('./events').filter((file) => file.endsWith('.js'));
// Charge all event files
for (const file of eventFiles) {
const event = require(`./events/${file}`);
client.on(event.name, (...args) => event.execute(...args, client));
}
client.login(process.env.TOKEN);