-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbot.js
More file actions
27 lines (21 loc) · 861 Bytes
/
bot.js
File metadata and controls
27 lines (21 loc) · 861 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
import "dotenv/config";
import { Events } from "discord.js";
import { createClient } from "./src/client/createClient.js";
import { ensureEnvVars } from "./src/config/env.js";
import { registerSlashCommands } from "./src/commands/registerSlashCommands.js";
import { registerInteractionHandler } from "./src/handlers/interactionHandler.js";
import { registerMemberHandlers } from "./src/handlers/memberHandlers.js";
ensureEnvVars();
const client = createClient();
client.once(Events.ClientReady, async () => {
console.log(`Bot logged in as ${client.user.tag}`);
try {
await registerSlashCommands(client);
console.log("Slash commands registered.");
} catch (err) {
console.error("Failed to register slash commands:", err);
}
});
registerInteractionHandler(client);
registerMemberHandlers(client);
client.login(process.env.DISCORD_TOKEN);