mirror of
https://git.femboyfinancial.jp/james/FemScoreboard.git
synced 2024-11-22 02:32:02 -08:00
Check channel existence before sending motd
This commit is contained in:
parent
2896eb491e
commit
95037db6b1
@ -77,6 +77,10 @@ async function scheduleRandomMessage(firstTime = false)
|
|||||||
{
|
{
|
||||||
if (!firstTime) {
|
if (!firstTime) {
|
||||||
const channel = <TextChannel> await client.channels.fetch(process.env.MOTD_CHANNEL);
|
const channel = <TextChannel> 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();
|
const randomMessage = await fetchMotd();
|
||||||
await channel.send(randomMessage);
|
await channel.send(randomMessage);
|
||||||
logInfo(`[bot] Sent MOTD: ${randomMessage}`);
|
logInfo(`[bot] Sent MOTD: ${randomMessage}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user