-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.js
48 lines (41 loc) · 1.36 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import dotenv from "dotenv";
dotenv.config();
import fs from "fs";
import { Client, GatewayIntentBits, Events, Collection } from "discord.js";
import { getAdmins } from "./helpers/getAdmins.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
client.login(process.env.TOKEN);
client.once(Events.ClientReady, () => {
client.commands = new Collection();
client.buttons = new Collection();
client.modals = new Collection();
const functions = fs
.readdirSync("./functions")
.filter((file) => file.endsWith(".js"));
const eventFiles = fs
.readdirSync("./events")
.filter((file) => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");
(async () => {
for (const file of functions) {
const module = await import(`./functions/${file}`);
module.default(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");
client.handleButtons();
client.handleModals();
client.handleLogs();
client.handlePRISM();
client.handleInfo();
client.handleTrackersDemos();
getAdmins(client);
})();
});