generated from Discord-Botique/bot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
29 lines (25 loc) · 976 Bytes
/
index.ts
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
import { ready } from "@events/ready";
import { Client, ClientEvents } from "discord.js";
import type { Event } from "@events/types";
import { logtail } from "@utils/logtail";
import { interactionCreate } from "@events/interactionCreate";
const client = new Client({
allowedMentions: {
parse: ["everyone", "roles", "users"],
},
// https://discord.com/developers/docs/topics/gateway#list-of-intents
intents: [],
// https://discordjs.guide/popular-topics/partials.html#enabling-partials
partials: [],
});
const events: Event<keyof ClientEvents>[] = [ready, interactionCreate];
events.forEach((event) => {
// The ready event should only run once, when the app is ready
if (event.once) client.once(event.name, (...args) => event.execute(...args));
else client.on(event.name, (...args) => event.execute(...args));
});
client.login(process.env.TOKEN).catch((err) =>
logtail.error("Could not login to Discord.", {
error: JSON.stringify(err),
}),
);