diff --git a/discord/bot.ts b/discord/bot.ts index c0313a4..c09de36 100644 --- a/discord/bot.ts +++ b/discord/bot.ts @@ -77,6 +77,10 @@ async function scheduleRandomMessage(firstTime = false) { if (!firstTime) { const channel = await client.channels.fetch(process.env.MOTD_CHANNEL); + if (!channel) { + console.warn(`[bot] Channel ${process.env.MOTD_CHANNEL} not found, disabling MOTD.`); + return; + } const randomMessage = await fetchMotd(); await channel.send(randomMessage); logInfo(`[bot] Sent MOTD: ${randomMessage}`);