Fix: Cache regular Miku avatar URL to prevent pfp bleed in bipolar arguments
When Evil Mode activates, the bot's Discord account avatar is changed to evil_pfp.png. Previously, get_persona_avatar_urls() would read this swapped avatar and pass it to the Miku webhook, causing both webhooks to display Evil Miku's pfp. Now caching the regular Miku CDN URL before Evil Mode changes the bot's avatar. When Evil Mode is active, the cached URL is used instead of reading from the bot account. Discord CDN URLs remain valid after avatar changes, so this reliably preserves the correct pfp for both regular and Evil Miku webhooks during arguments. - Added MIKU_NORMAL_AVATAR_URL global in bot/globals.py - Updated get_persona_avatar_urls() to cache and return the cached URL - Save the normal avatar URL before Evil Mode switches the bot's avatar
This commit is contained in:
@@ -600,6 +600,14 @@ async def apply_evil_mode_changes(client, change_username=True, change_pfp=True,
|
||||
if current_color:
|
||||
save_evil_mode_state(saved_role_color=current_color)
|
||||
|
||||
# Cache the regular Miku avatar URL before switching to evil pfp
|
||||
# (Discord CDN URLs remain valid after the avatar changes)
|
||||
if globals.client and globals.client.user:
|
||||
try:
|
||||
globals.MIKU_NORMAL_AVATAR_URL = str(globals.client.user.display_avatar.url)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
globals.EVIL_MODE = True
|
||||
|
||||
# Change bot username (if requested and possible - may be rate limited)
|
||||
|
||||
Reference in New Issue
Block a user