feat: fix evil mode race conditions, expand moods and PFP detection
bipolar_mode.py: - Replace unsafe globals.EVIL_MODE temporary overrides with force_evil_context parameter to fix async race conditions (3 sites) moods.py: - Add 6 new evil mood emojis: bored, manic, jealous, melancholic, playful_cruel, contemptuous - Refactor rotate_dm_mood() to skip when evil mode active (evil mode has its own independent 2-hour rotation timer) persona_dialogue.py: - Same force_evil_context race condition fix (2 sites) - Fix over-aggressive response cleanup that stripped common words (YES/NO/HIGH) — now uses targeted regex for structural markers only - Update evil mood multipliers to match new mood set profile_picture_context: - Expand PFP detection regex for broader coverage (appearance questions, opinion queries, selection/change questions) - Add plugin.json metadata file
This commit is contained in:
@@ -33,7 +33,13 @@ EVIL_MOOD_EMOJIS = {
|
||||
"aggressive": "👿",
|
||||
"cunning": "🐍",
|
||||
"sarcastic": "😈",
|
||||
"evil_neutral": ""
|
||||
"evil_neutral": "",
|
||||
"bored": "🥱",
|
||||
"manic": "🤪",
|
||||
"jealous": "💚",
|
||||
"melancholic": "🌑",
|
||||
"playful_cruel": "🎭",
|
||||
"contemptuous": "👑"
|
||||
}
|
||||
|
||||
def load_mood_description(mood_name: str) -> str:
|
||||
@@ -150,33 +156,32 @@ def detect_mood_shift(response_text, server_context=None):
|
||||
return None
|
||||
|
||||
async def rotate_dm_mood():
|
||||
"""Rotate DM mood automatically (handles both normal and evil mode)"""
|
||||
"""Rotate DM mood automatically (normal mode only — evil has its own independent timer)"""
|
||||
try:
|
||||
from utils.evil_mode import is_evil_mode, rotate_evil_mood
|
||||
from utils.evil_mode import is_evil_mode
|
||||
|
||||
if is_evil_mode():
|
||||
# Rotate evil mood instead
|
||||
await rotate_evil_mood()
|
||||
else:
|
||||
# Normal mood rotation
|
||||
old_mood = globals.DM_MOOD
|
||||
new_mood = old_mood
|
||||
attempts = 0
|
||||
# Filter out 'asleep' — DMs have no sleepy→asleep transition guard
|
||||
dm_eligible = [m for m in globals.AVAILABLE_MOODS if m != "asleep"]
|
||||
|
||||
while new_mood == old_mood and attempts < 5:
|
||||
new_mood = random.choice(dm_eligible)
|
||||
attempts += 1
|
||||
|
||||
globals.DM_MOOD = new_mood
|
||||
globals.DM_MOOD_DESCRIPTION = load_mood_description(new_mood)
|
||||
|
||||
logger.info(f"DM mood rotated from {old_mood} to {new_mood}")
|
||||
# Evil mode has its own independent 2-hour rotation timer in evil_mode.py
|
||||
# Do nothing here — evil mood rotation is handled by start_evil_mood_rotation()
|
||||
logger.debug("Skipping DM mood rotation — evil mode has its own timer")
|
||||
return
|
||||
|
||||
# Note: We don't update server nicknames here because servers have their own independent moods.
|
||||
# DM mood only affects direct messages to users.
|
||||
# Normal mood rotation
|
||||
old_mood = globals.DM_MOOD
|
||||
new_mood = old_mood
|
||||
attempts = 0
|
||||
# Filter out 'asleep' — DMs have no sleepy→asleep transition guard
|
||||
dm_eligible = [m for m in globals.AVAILABLE_MOODS if m != "asleep"]
|
||||
|
||||
while new_mood == old_mood and attempts < 5:
|
||||
new_mood = random.choice(dm_eligible)
|
||||
attempts += 1
|
||||
|
||||
globals.DM_MOOD = new_mood
|
||||
globals.DM_MOOD_DESCRIPTION = load_mood_description(new_mood)
|
||||
|
||||
logger.info(f"DM mood rotated from {old_mood} to {new_mood}")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Exception in rotate_dm_mood: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user