From 73a8471f4b43ebcf116bd28fb7c9ff8f5e46dba5 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Sat, 6 Jan 2024 23:46:21 +1100 Subject: [PATCH] Hotfix for no log whenever the "Server didn't respond" embed appears --- src/modules/MPModule.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/MPModule.ts b/src/modules/MPModule.ts index 8397172..6ff2398 100644 --- a/src/modules/MPModule.ts +++ b/src/modules/MPModule.ts @@ -21,7 +21,10 @@ export default async(client:TClient)=>{ async function newServerEntry(server:IServer) { const serverData = await requestServerData(client, server); - if (!serverData) return new client.embed().setColor(client.config.embedColorRed).setTitle('Server didn\'t respond').setFooter({text: 'Last updated'}).setTimestamp(); + if (!serverData) { + Logger.console('log', loggingPrefix, `${server.serverName} seems to be unavailable to take requests at this time`) + return new client.embed().setColor(client.config.embedColorRed).setTitle('Server didn\'t respond').setFooter({text: 'Last updated'}).setTimestamp(); + }; const {dss, csg} = serverData; if (dss === null ?? csg === null ?? !dss ?? !csg ?? !dss.slots ?? !csg.slotSystem) return new client.embed().setColor(client.config.embedColorRed).setTitle(`${server.serverName} did not respond`).setFooter({text: 'Last updated'}).setTimestamp(); // Skip the server if the parts of the data is missing. @@ -85,7 +88,7 @@ export default async(client:TClient)=>{ let hookId = isBotInDevMode ? '1098524887557099520' : '1159998634604109897'; let msgId = isBotInDevMode ? '1159855742535352462' : '1160098458997370941'; const mfServer = cachedServers.find(s=>s.ip.split(':')[1] === '18001' && s.isActive); - if (mfServer) multifarmWebhook(client, mfServer, hookId, msgId); + if (mfServer && mfServer.isActive) multifarmWebhook(client, mfServer, hookId, msgId); } async function multifarmWebhook(client:TClient, server:IServer, webhookId:string, messageId:string) {