fix(P2): 5 priority-2 bug fixes — emoji consolidation, DM safety, pause gap
#10 Redundant coin flip in join_conversation — removed the 50% random gate that doubled the V2 engine's own decision to act. #11 Message-triggered actions skip _autonomous_paused — _check_and_act and _check_and_react now bail out immediately when the autonomous system is paused (voice session), matching the scheduled-tick path. #12 Duplicate emoji dictionaries — removed MOOD_EMOJIS and EVIL_MOOD_EMOJIS from globals.py (had different emojis from moods.py). bipolar_mode.py and evil_mode.py now import the canonical dicts from utils/moods.py so all code sees the same emojis. #13 DM mood can spontaneously become 'asleep' — rotate_dm_mood() now filters 'asleep' out of the candidate list since DMs have no sleepy-to-asleep transition guard and no wakeup timer. #15 Engage-user fallback misreports action type — log level raised to WARNING with an explicit [engage_user->general] prefix so the cooldown-triggered fallback is visible in logs.
This commit is contained in:
@@ -184,6 +184,9 @@ async def _check_and_react(guild_id: int, message):
|
||||
Check if Miku should react to a new message with an emoji.
|
||||
Called for each new message in real-time.
|
||||
"""
|
||||
if _autonomous_paused:
|
||||
return
|
||||
|
||||
# Calculate message age
|
||||
from datetime import datetime, timezone
|
||||
message_age = (datetime.now(timezone.utc) - message.created_at).total_seconds()
|
||||
@@ -211,6 +214,9 @@ async def _check_and_act(guild_id: int):
|
||||
Uses per-guild lock to prevent race conditions from near-simultaneous messages.
|
||||
"""
|
||||
async with _get_action_lock(guild_id):
|
||||
if _autonomous_paused:
|
||||
return
|
||||
|
||||
# Rate limiting check
|
||||
now = time.time()
|
||||
if guild_id in _last_action_execution:
|
||||
|
||||
Reference in New Issue
Block a user