Lower mute thresholds and order warnings before chat replies
- spike_mute: 0.8→0.7, mute: 0.75→0.65 so escalating users get timed out after a warning instead of endlessly warned - Skip debounce on @mentions so sentiment analysis fires immediately - Chat cog awaits pending sentiment analysis before replying, ensuring warnings/mutes appear before the personality response Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
cogs/chat.py
13
cogs/chat.py
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import logging
|
||||
from collections import deque
|
||||
from pathlib import Path
|
||||
@@ -125,6 +126,18 @@ class ChatCog(commands.Cog):
|
||||
{"role": "assistant", "content": response}
|
||||
)
|
||||
|
||||
# Wait for any pending sentiment analysis to finish first so
|
||||
# warnings/mutes appear before the chat reply
|
||||
sentiment_cog = self.bot.get_cog("SentimentCog")
|
||||
if sentiment_cog:
|
||||
key = (message.channel.id, message.author.id)
|
||||
task = sentiment_cog._debounce_tasks.get(key)
|
||||
if task and not task.done():
|
||||
try:
|
||||
await asyncio.wait_for(asyncio.shield(task), timeout=15)
|
||||
except (asyncio.TimeoutError, asyncio.CancelledError):
|
||||
pass
|
||||
|
||||
await message.reply(response, mention_author=False)
|
||||
logger.info(
|
||||
"Chat reply in #%s to %s: %s",
|
||||
|
||||
Reference in New Issue
Block a user