diff --git a/src/bot.ts b/src/bot.ts index f774613..11b59a9 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -1,5 +1,5 @@ import { BotEmitter, initCommands } from "@wackford/mod.ts"; -import { Intents } from "@wackford/discordeno.ts"; +import { Intents, sendMessage } from "@wackford/discordeno.ts"; import initLocalCommands from "./commands/index.ts"; import initOnMessage from "./events/onMessage.ts"; import initAIs from "./ai/index.ts"; @@ -19,6 +19,21 @@ initLocalCommands(); initCommands(); initAIs(); +await BotEmitter.on("ready", (bot) => { + Deno.addSignalListener("SIGINT", () => { + config.discord.channels.forEach(async channelId => { + await sendMessage(bot, channelId, { + content: "Apologies, bot going down for maintenance!" + }) + }) + }) + config.discord.channels.forEach(async channelId => { + await sendMessage(bot, channelId, { + content: "The bot is back online!" + }) + }) +}) + await BotEmitter.emit("start", { token: Deno.env.get("TOKEN") ?? config.discord.token ?? (() => { throw new GoofyAhhException("No token?");