Files
discordeno/template/minimal/mod.ts
ITOH 5f25263bd4 chore(template): to main repo (#1988)
* chore: move template to main repo

* ci

* Update sync_repos.yml
2022-02-03 18:02:44 +00:00

43 lines
982 B
TypeScript

import { ActivityTypes, createBot, enableCachePlugin, enableCacheSweepers, fastFileLoader, startBot } from "./deps.ts";
import { BOT_ID, BOT_TOKEN } from "./configs.ts";
import { logger } from "./src/utils/logger.ts";
import { events } from "./src/events/mod.ts";
import { updateCommands } from "./src/utils/helpers.ts";
const log = logger({ name: "Main" });
log.info("Starting Bot, this might take a while...");
const paths = ["./src/events", "./src/commands"];
await fastFileLoader(paths).catch((err) => {
log.fatal(`Unable to Import ${paths}`);
log.fatal(err);
Deno.exit(1);
});
export const bot = enableCachePlugin(
createBot({
token: BOT_TOKEN,
botId: BOT_ID,
intents: [],
events,
}),
);
enableCacheSweepers(bot);
bot.gateway.presence = {
status: "online",
activities: [
{
name: "Discordeno is Best Lib",
type: ActivityTypes.Game,
createdAt: Date.now(),
},
],
};
await startBot(bot);
await updateCommands(bot);