From 7564b1a8f066183df390887ddfd4d73e0baa87ac Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Wed, 9 Apr 2025 20:14:32 +0700 Subject: [PATCH] fix(bots/discord): attempt to fix sticky messages again --- apis/websocket/package.json | 2 +- bots/discord/package.json | 2 +- .../events/discord/messageCreate/stickyMessageReset.ts | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apis/websocket/package.json b/apis/websocket/package.json index 8bb1b87..5553234 100755 --- a/apis/websocket/package.json +++ b/apis/websocket/package.json @@ -37,4 +37,4 @@ "@types/ws": "^8.18.1", "typed-emitter": "^2.1.0" } -} \ No newline at end of file +} diff --git a/bots/discord/package.json b/bots/discord/package.json index 841d351..942d28a 100644 --- a/bots/discord/package.json +++ b/bots/discord/package.json @@ -43,4 +43,4 @@ "discord-api-types": "^0.37.119", "drizzle-kit": "^0.22.8" } -} \ No newline at end of file +} diff --git a/bots/discord/src/events/discord/messageCreate/stickyMessageReset.ts b/bots/discord/src/events/discord/messageCreate/stickyMessageReset.ts index 8a7a4f5..9ad7e6b 100644 --- a/bots/discord/src/events/discord/messageCreate/stickyMessageReset.ts +++ b/bots/discord/src/events/discord/messageCreate/stickyMessageReset.ts @@ -31,8 +31,13 @@ withContext(on, 'messageCreate', async ({ discord, logger }, msg) => { store.forceTimerMs, ) as NodeJS.Timeout else store.forceTimer.refresh() - // Force timer is already active, so we force send - } else store.send() + } else { + // Force timer is already active, so we clear the force timer + store.forceTimerActive = false + clearTimeout(store.forceTimer) + // and force send + store.send(true) + } } } else if (!store.forceTimerActive) { // Both timers aren't active, so we start the timer