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:
2026-02-23 13:43:15 +02:00
parent 0e4aebf353
commit 2b743ed65e
6 changed files with 20 additions and 32 deletions

View File

@@ -304,7 +304,7 @@ async def miku_engage_random_user_for_server(guild_id: int, user_id: str = None,
# Skip cooldown check if this is a manual trigger from web UI
if not manual_trigger and now - last_time < 43200: # 12 hours in seconds
logger.info(f"Recently engaged {target.display_name} in server {guild_id}, switching to general message.")
logger.warning(f"[engage_user→general] Recently engaged {target.display_name} in server {guild_id}, falling back to general message (cooldown).")
await miku_say_something_general_for_server(guild_id)
return
@@ -456,10 +456,7 @@ async def miku_detect_and_join_conversation_for_server(guild_id: int, force: boo
# Not enough activity
logger.debug(f"[Join Conv] Not enough activity: {len(recent_msgs)} messages, {len(user_ids)} users (need 5+ messages, 2+ users)")
return
if random.random() > 0.5:
logger.debug(f"[Join Conv] Random chance failed (50% chance)")
return # 50% chance to engage
# Note: V1 had a redundant 50% coin flip here, removed since V2 engine already decided to act
else:
logger.debug(f"[Join Conv] Force mode - bypassing activity checks")
if len(recent_msgs) < 1: