generated from discordeno/template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
mod.ts
61 lines (53 loc) · 1.91 KB
/
mod.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { fileLoader, importDirectory } from "./src/utils/helpers.ts";
import { loadLanguages } from "./src/utils/i18next.ts";
import { configs } from "./configs.ts";
import { botCache, Intents, startBot } from "./deps.ts";
console.info("Beginning Bot Startup Process. This can take a little bit depending on your system. Loading now...");
await importDirectory(Deno.realPathSync("./src/structures"));
await importDirectory(Deno.realPathSync("./src/controllers"));
// Load these first before anything else so they are available for the rest.
await importDirectory(Deno.realPathSync("./src/constants"));
await importDirectory(Deno.realPathSync("./src/helpers"));
await importDirectory(Deno.realPathSync("./src/events"));
await fileLoader();
if (!botCache.eventHandlers.debug) throw "No events loaded";
// The order of these is not important.
await Promise.all(
[
"./src/commands",
"./src/inhibitors",
"./src/arguments",
"./src/monitors",
"./src/tasks",
"./src/permissionLevels",
].map((path) => importDirectory(Deno.realPathSync(path)))
);
await fileLoader();
if (!botCache.commands.size) throw "No commands loaded";
if (!botCache.arguments.size) throw "No args loaded";
console.info("Loading Languages...");
// Loads languages
await loadLanguages();
console.info("Loading Database");
await import("./src/database/database.ts");
console.log("Loaded Database, starting bot...");
startBot({
token: configs.token,
// Pick the intents you wish to have for your bot.
intents: [
Intents.GUILDS,
Intents.GUILD_MESSAGES,
Intents.DIRECT_MESSAGES,
Intents.GUILD_MEMBERS,
Intents.GUILD_BANS,
Intents.GUILD_EMOJIS,
Intents.GUILD_VOICE_STATES,
Intents.GUILD_INVITES,
Intents.GUILD_MESSAGE_REACTIONS,
Intents.DIRECT_MESSAGE_REACTIONS,
1 << 15,
// 46287
],
// These are all your event handler functions. Imported from the events folder
eventHandlers: botCache.eventHandlers,
});