Files
discordeno/template/minimal/mod.ts
meister03 0fb4e1f398 Update minimal template (#2314)
* Outdate template

* don't use `.env.example`

* 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:19 -04:00

55 lines
1.2 KiB
TypeScript

import {
ActivityTypes,
createBot,
enableCachePlugin,
enableCacheSweepers,
fastFileLoader,
GatewayIntents,
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: GatewayIntents.Guilds,
events,
}),
);
// @ts-nocheck: no-updated-depencdencies
enableCacheSweepers(bot);
bot.gateway.manager.createShardOptions.makePresence = (shardId: number) => {
return {
shardId: shardId,
status: "online",
activities: [
{
name: "Discordeno is Best Lib",
type: ActivityTypes.Game,
createdAt: Date.now(),
},
],
};
};
await startBot(bot);
await updateCommands(bot);