From 0f8b3f7702afb19e535b4f70470bb40d3922a3d8 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Fri, 19 May 2023 19:16:28 -0600 Subject: [PATCH] UGH --- index.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index a8c5067..478a36a 100644 --- a/index.js +++ b/index.js @@ -193,8 +193,16 @@ function updateStatus(addr, port, msg) { embeds: [embed] }).then(() => { console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} ${addr}:${port} is online, edited embed.`); + setTimeout(() => { + console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} Updating ${server.ip}:${server.port}`); + updateStatus(addr, port, msg); + }, 15000) }).catch((err) => { console.log(`${colors.red("[ERROR]")} ${err}`); + setTimeout(() => { + console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} Updating ${server.ip}:${server.port}`); + updateStatus(addr, port, msg); + }, 15000) }); } else { console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} ${addr}:${port} is offline.`); @@ -239,8 +247,16 @@ function updateStatus(addr, port, msg) { "embeds": [serverEmbeds[`${addr}:${port}`]] }).then((msg) => { console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} ${addr}:${port} is offline, edited embed.`); + setTimeout(() => { + console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} Updating ${server.ip}:${server.port}`); + updateStatus(addr, port, msg); + }, 15000) }).catch((err) => { console.log(`${colors.red("[ERROR]")} ${err}`); + setTimeout(() => { + console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} Updating ${server.ip}:${server.port}`); + updateStatus(addr, port, msg); + }, 15000) }); } }) @@ -282,10 +298,6 @@ client.on("ready", async () => { client.channels.fetch(server.channelId).then((channel) => { channel.messages.fetch(server.messageId).then((message) => { updateStatus(server.ip, server.port, message) - setInterval(() => { - console.log(`${colors.magenta(`[DEBUG ${new Date()}]`)} Updating ${server.ip}:${server.port}`); - updateStatus(server.ip, server.port, message); - }, 15000); }); }); });