Files
discordeno/template/beginner/bot.ts
meister03 b5105cbc32 Fix beginner template (#2315)
* Fix beginner template

* deno fmt

* deno fmt

Co-authored-by: meister03 <meisterpi@gmail.com>
Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
2022-08-23 10:30:54 -04:00

37 lines
972 B
TypeScript

import { configs } from "./configs.ts";
import {
BotWithCache,
BotWithHelpersPlugin,
Collection,
createBot,
enableCachePlugin,
enableCacheSweepers,
enableHelpersPlugin,
enablePermissionsPlugin,
GatewayIntents,
} 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: GatewayIntents.Guilds,
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();