-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
35 lines (30 loc) · 1.28 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
import { performance } from "node:perf_hooks";
import { Client, GatewayIntentBits, Partials } from "discord.js";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { token } from "./config.js";
import { CommandHandler } from "./src/structures/Commands.js";
import { EventHandler } from "./src/structures/Events.js";
import { ButtonHandler } from './src/structures/Button.js';
import { ModalManager } from './src/structures/Modal.js'
let start = performance.now();
const __dirname = dirname(fileURLToPath(import.meta.url));
export const rootPath = __dirname;
const client = new Client({
intents: [
GatewayIntentBits.Guilds | GatewayIntentBits.DirectMessages | GatewayIntentBits.GuildMessageReactions | GatewayIntentBits.DirectMessageReactions | GatewayIntentBits.GuildVoiceStates,
],
partials: [Partials.Channel],
});
client.events = new Map();
client.buttonCommands = new Map();
client.slashCommands = new Map();
client.modals = new Map();
CommandHandler(client, rootPath);
EventHandler(client, rootPath);
ButtonHandler(client, rootPath);
ModalManager(client, rootPath);
client.login(token);
let end = performance.now();
const startupTime = (end - start) / 1000; // to seconds
console.log(`Startup time: ${startupTime} seconds`);