-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (22 loc) · 748 Bytes
/
index.js
File metadata and controls
27 lines (22 loc) · 748 Bytes
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
const { Client, Collection, GatewayIntentBits } = require('discord.js');
const { logError, logInfo } = require('./utils/logger');
const eventHandler = require('./handler/events');
// Initialize Discord Client
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
],
});
client.commands = new Collection();
// Execute the event handler logic to bind events
logInfo('Initializing handlers...');
eventHandler(client);
// Login
if (!process.env.BOT_TOKEN || !process.env.CLIENT_ID) {
logError('Missing BOT_TOKEN or CLIENT_ID environment variables.');
process.exit(1);
}
client.login(process.env.BOT_TOKEN).catch(err => {
logError(`Login failed: ${err.message}`);
});