Add uptime/downtime messages

pull/1/head
Drake 2 years ago
parent d5b1572740
commit baedce0845

@ -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?");

Loading…
Cancel
Save