westrany / Lotro-Server-Status-Discord-Bot

A bot for Discord servers that updates you with server status for the Lord of the Rings Online mmorpg
MIT License
0 stars 0 forks source link

Summary messages for /monitor do not show #1

Open westrany opened 2 weeks ago

westrany commented 2 weeks ago

Summary messages that show up when using /monitor are not being printed by the bot in bot.js.

Relevant code:

// Only send messages if the status has changed
    if (hasStatusChanged) {
      // Handle cases where all servers are up or down
      const allServersUp = Object.values(currentStatuses).every(status => status === 'UP');
      const allServersDown = Object.values(currentStatuses).every(status => status === 'DOWN');

      if (allServersUp) {
        const allUpEmbed = new EmbedBuilder()
          .setColor('#00FF00')
          .setDescription('🎉 All servers are up 🎉')
          .setTimestamp();
        await channel.send({ embeds: [allUpEmbed] });
      } else if (allServersDown) {
        const allDownEmbed = new EmbedBuilder()
          .setColor('#FF0000')
          .setDescription('⚠️ All servers are down! ⚠️')
          .setTimestamp();
        await channel.send({ embeds: [allDownEmbed] });
      } else {
        // Send grouped messages for servers going up or down
        if (serversUp.length > 0) {
          const upMessage = `✅ ${serversUp.join(', ')} ${serversUp.length > 1 ? 'are' : 'is'} back up ✅`;
          const upEmbed = new EmbedBuilder().setColor('#00FF00').setDescription(upMessage).setTimestamp();
          await channel.send({ embeds: [upEmbed] });
        }

        if (serversDown.length > 0) {
          const downMessage = `⚠️ ${serversDown.join(', ')} ${serversDown.length > 1 ? 'are' : 'is'} down! ⚠️`;
          const downEmbed = new EmbedBuilder().setColor('#FF0000').setDescription(downMessage).setTimestamp();
          await channel.send({ embeds: [downEmbed] });
        }
      }

This was working before getting the Bot to run on Railway and produced results as shown in this image: image

westrany commented 2 weeks ago

Maybe put this outside of /monitor's section since this could also show up when user types /server and wishes to see all servers' statuses?

dt192 commented 2 weeks ago

I get this or am I not running on the Railway version? 2024-09-19_06-58

dt192 commented 2 weeks ago

Maybe put this outside of /monitor's section since this could also show up when user types /server and wishes to see all servers' statuses?

Yes probably need /monitor disable (current channel) /monitor disable channel-name /monitor disable all and some sort of status command like /monitor list.