Refactor activity system: energy-based probability, manual override, all 5 activity types

- Rewrite utils/activities.py with mood energy-driven activity probability
  (high-energy moods like excited/bubbly show activity ~80-85% of the time,
  low-energy moods like sleepy/melancholy only ~15-25%)
- Add manual override system with 30-min auto-expiry for Web UI control
- Support all 5 Discord activity types: listening, playing, watching,
  competing, streaming (with purple LIVE badge via discord.Streaming)
- Add current activity tracking (get_current_activity)
- Add force=True param to update_bot_presence for on_ready (bot.py)
- Add 4 new API routes for manual override:
  GET/POST/DELETE /activities/current, POST /activities/current/auto
- Expand activities.yaml from 139 to 157 entries, adding watching,
  competing, and streaming entries across 11 moods
- Update Web UI: activity type dropdown with all 5 types, conditional
  URL field for streaming, 'Current Activity' override panel with
  set/clear/auto controls, type-aware icons and labels
This commit is contained in:
2026-04-27 23:39:18 +03:00
parent 9bc618b526
commit d6cdb89e42
5 changed files with 556 additions and 49 deletions

View File

@@ -140,9 +140,9 @@ async def on_ready():
try:
from utils.activities import update_bot_presence
if globals.EVIL_MODE:
await update_bot_presence(globals.EVIL_DM_MOOD, is_evil=True)
await update_bot_presence(globals.EVIL_DM_MOOD, is_evil=True, force=True)
else:
await update_bot_presence(globals.DM_MOOD, is_evil=False)
await update_bot_presence(globals.DM_MOOD, is_evil=False, force=True)
except Exception as e:
logger.error(f"Failed to set initial presence: {e}")