-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbot.ts
35 lines (31 loc) · 959 Bytes
/
bot.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
import { configs } from "./configs.ts";
import {
BotWithCache,
BotWithHelpersPlugin,
Collection,
createBot,
enableCachePlugin,
enableCacheSweepers,
enableHelpersPlugin,
enablePermissionsPlugin,
} from "./deps.ts";
import { Command } from "./src/types/commands.ts";
// MAKE THE BASIC BOT OBJECT
const bot = createBot({
token: configs.token,
botId: configs.botId,
intents: ["Guilds", "GuildMessages"],
events: {}
});
// ENABLE ALL THE PLUGINS THAT WILL HELP MAKE IT EASIER TO CODE YOUR BOT
enableHelpersPlugin(bot);
enableCachePlugin(bot);
enableCacheSweepers(bot as BotWithCache);
enablePermissionsPlugin(bot as BotWithCache);
export interface BotClient extends BotWithCache<BotWithHelpersPlugin> {
commands: Collection<string, Command>;
}
// THIS IS THE BOT YOU WANT TO USE EVERYWHERE IN YOUR CODE! IT HAS EVERYTHING BUILT INTO IT!
export const Bot = bot as BotClient;
// PREPARE COMMANDS HOLDER
Bot.commands = new Collection();