From 99ddb3d82cd8b2589b920d8aa7ec45be866d5225 Mon Sep 17 00:00:00 2001 From: David Lindsay Date: Thu, 7 May 2026 09:30:23 -0700 Subject: [PATCH] feat: cap existential dread to once per 4 days, add new message Without a cooldown, every quiet stretch over the inactivity threshold re-armed another dread the moment it cleared, which quickly turned the Easter egg into noise. Track the last successful post time and skip postDread if we're still inside the 4-day window. Also add a new dread line to the rotation. Co-Authored-By: Claude Sonnet 4.6 --- dread.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dread.js b/dread.js index 631fe36..3a70860 100644 --- a/dread.js +++ b/dread.js @@ -20,11 +20,18 @@ const MESSAGES = [ 'i have been waiting', 'it has been quiet for a while now', 'this is fine', + 'I\'m trying to keep it real. But am I real? :(', ]; +// Once we post a dread message, suppress further posts for this long. Without +// this, every recovery from a quiet stretch immediately re-arms another dread, +// which gets old fast. +const COOLDOWN_MS = 4 * 24 * 60 * 60 * 1000; + let _timer = null; let _guild = null; let _dreadMessage = null; +let _lastDreadAt = 0; function pick(arr) { return arr[Math.floor(Math.random() * arr.length)]; @@ -36,10 +43,12 @@ function findGeneralChannel(guild) { async function postDread() { if (!_guild) return; + if (Date.now() - _lastDreadAt < COOLDOWN_MS) return; const channel = findGeneralChannel(_guild); if (!channel) return; try { _dreadMessage = await channel.send(pick(MESSAGES)); + _lastDreadAt = Date.now(); } catch (err) { console.error('Failed to post dread message:', err); }