You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
936 B

import { BotEmitter, initCommands } from "@wackford/mod.ts";
import { Intents } from "@wackford/discordeno.ts";
import initLocalCommands from "./commands/index.ts";
import initOnMessage from "./events/onMessage.ts";
import initAIs from "./ai/index.ts";
import initDB from "./database.ts";
import config from "./config.ts";
import initSocket from "./socket.ts";
export class GoofyAhhException extends Error {
constructor(message: string) {
super(message);
this.name = "GoofyAhhException";
}
}
await initDB();
if (config.websocket.enabled) initSocket(config.websocket.hostname, config.websocket.port);
initOnMessage();
initLocalCommands();
initCommands();
initAIs();
await BotEmitter.emit("start", {
token: Deno.env.get("TOKEN") ?? config.discord.token ?? (() => {
throw new GoofyAhhException("No token?");
})(),
intents: Intents.Guilds | Intents.GuildMessages | Intents.MessageContent,
});