From 9c53dfe52c50f0b5cb31ac796a57300c492ea770 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Fri, 17 May 2024 22:30:33 +0200 Subject: [PATCH] resolve timeout expiring issue --- labscore/client.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/labscore/client.js b/labscore/client.js index 134fec3..b057bbc 100644 --- a/labscore/client.js +++ b/labscore/client.js @@ -57,7 +57,7 @@ const commandClient = new CommandClient(cluster, { This code checks if the bot is currently timed out, preventing any and all commands from being executed. */ - + // Only apply filters below to a GUILD context. if(!context.guild) return true; @@ -65,8 +65,13 @@ const commandClient = new CommandClient(cluster, { // Bot member is not cached for whatever reason, fetch it. if(b === undefined) b = await context.guild.fetchMember(context.client.user.id); - // Bot is timed out. Do not run anything until no longer timed out. - if(b.communicationDisabledUntil !== null) return false; + // Bot is (potentially) timed out. + if(b.communicationDisabledUntil !== null){ + // Timeout is active. This additional check is necessary, + // as our cache does not appear to update when the bots + // timeout expires. + if((b.communicationDisabledUntilUnix - Date.now()) >= 1) return false; + } // Command should be fine to run. return true;