feat: add unblock-nag detection and redirect

Keyword-based detection for users repeatedly asking to be unblocked in
chat. Fires an LLM-generated snarky redirect (with static fallback),
tracks per-user nag count with escalating sass, and respects a 30-min
cooldown. Configurable via config.yaml unblock_nag section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 13:19:29 -04:00
parent 733b86b947
commit f79de0ea04
5 changed files with 198 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ from cogs.sentiment.coherence import handle_coherence_alert
from cogs.sentiment.log_utils import log_analysis
from cogs.sentiment.state import flush_dirty_states
from cogs.sentiment.topic_drift import handle_topic_drift
from cogs.sentiment.unblock_nag import handle_unblock_nag, matches_unblock_nag
logger = logging.getLogger("bcs.sentiment")
@@ -153,6 +154,12 @@ class SentimentCog(commands.Cog):
if not message.content or not message.content.strip():
return
# Check for unblock nagging (keyword-based, no LLM needed for detection)
if matches_unblock_nag(message.content):
asyncio.create_task(handle_unblock_nag(
self.bot, message, self._dirty_users,
))
# Buffer the message and start/reset debounce timer (per-channel)
channel_id = message.channel.id
if channel_id not in self._message_buffer: