-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (35 loc) · 1.06 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
const { Client, GatewayIntentBits, Collection } = require("discord.js");
const config = require("./config");
const fs = require("node:fs");
const path = require("node:path");
require("./database/connect");
require("./server");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
//GatewayIntentBits.MessageContent,
],
});
client.commands = new Collection();
client.cooldowns = new Collection();
const handlerPath = path.join(__dirname, "handlers");
const handlerFiles = fs
.readdirSync(handlerPath)
.filter((file) => file.endsWith(".js"));
for (const file of handlerFiles) {
const filePath = path.join(handlerPath, file);
const handler = require(filePath);
if (handler.execute) {
handler.execute(client);
} else {
console.log(`[❌] ${file} Handler Doesn't Have Execute Function`);
}
}
process.on("unhandledRejection", (error) => {
console.error("[❌] Error: ", error);
});
process.on("uncaughtException", (error) => {
console.error("[❌] Error: ", error);
});
client.login(config.TOKEN);