Files
discordeno/template/minimal/mod.ts
T
Awesome StickzandSkillz4Killz b9766c6cb6 Update all templates' dd version, readme, added example env/config (#2500)
* Update bigbot template to v16, update readme, added .env.example for an example env

* Update minimal template to dd v16, update readme

* Update minimal template readme for consistency

* Update beginner template to v16, update readme

* Added config.json file, readme to nodejs template

* Fix kwik db stuff in beginner template

* deno fmt

* Update template readme

* Fix bigbot template raw event ignoring GUILD_CREATE instead of GUILD_LOADED_DD

* deno fmt

* fix deno fmt again

* Use .env file instead of config.json in nodejs template

* fix: kwik's version in beginner template

* Apply suggestions from code review

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>

* Update template/README.md

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2022-10-07 16:41:11 -05: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 the Best Lib",
type: ActivityTypes.Game,
createdAt: Date.now(),
},
],
};
};
await startBot(bot);
await updateCommands(bot);