-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
43 lines (38 loc) · 1.39 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { GatewayIntentBits, Partials } from "discord.js";
import { join } from "path";
import { readdirSync } from "fs";
import DiscordClient from "./client";
import { env } from "./utils/env";
import { checkScheduledEvents } from "./utils/scheduledEventFunctions";
const client = new DiscordClient({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildScheduledEvents,
// GatewayIntentBits.GuildInvites,
// GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
// GatewayIntentBits.GuildMessageTyping,
// GatewayIntentBits.DirectMessages,
// GatewayIntentBits.DirectMessageReactions,
// GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Message,
// Partials.Channel, // Required to receive DMs
Partials.Reaction, // Required to receive Reactions
],
});
const handlersPath = join(__dirname, "handlers");
const handlerFiles = readdirSync(handlersPath).filter((file) =>
file.endsWith("Handler.ts")
);
handlerFiles.forEach((handlerFile: any) => {
const filePath = join(handlersPath, handlerFile);
import(filePath).then((handler) => handler.default(client));
});
checkScheduledEvents(client.guilds);
client.login(env.TOKEN);