Test fix for more monitors?

This commit is contained in:
Christopher Cookman 2025-06-26 23:17:53 -06:00
parent 782fca6574
commit 06ebdb0459

View file

@ -48,9 +48,13 @@ function getStatus(input) {
let fieldParts = [];
for (monitor of cat.monitors) {
const status = new Boolean(monitor.heartbeats[0].status); // Turn it into a boolean because 0 and 1 are not always reliable in JS
console.log(`Monitor: ${monitor.name}, Status: ${status}`);
const monitorText = `${status ? "<:online:1307359583785713744>" : "<:offline:1307359600592424971>"} ${monitor.name}\n`;
const isOnline = Boolean(monitor.heartbeats[0].status); // Use Boolean() for clarity
console.log(`Monitor: ${monitor.name}, Status: ${isOnline}`);
const monitorText = `${isOnline ? "<:online:1307359583785713744>" : "<:offline:1307359600592424971>"} ${monitor.name}\n`;
// If the monitor is offline, increment the offline count
if (!isOnline) offline++;
total++;
// Check if adding this monitor's text will exceed 1024 characters
if (fieldText.length + monitorText.length > 1024) {
@ -61,10 +65,6 @@ function getStatus(input) {
// Otherwise, just add the monitor's text to the current field
fieldText += monitorText;
}
// If the monitor is offline, increment the offline count
if (!status) offline++;
total++;
}
// Push any remaining text in fieldText after processing all monitors