Fix webhook avatar mismatch: pass avatar_url at send time
- Fixed missing client parameter in animated GIF webhook update path - Added get_persona_avatar_urls() helper that returns bot's current Discord avatar URL for Miku persona (always fresh, no cache lag) - Pass avatar_url on every webhook.send() call in bipolar_mode.py, persona_dialogue.py, and api.py so avatars always match current pfp regardless of webhook cache state
This commit is contained in:
@@ -881,7 +881,8 @@ This pushed things over the edge into a full argument."""
|
||||
from utils.bipolar_mode import (
|
||||
get_or_create_webhooks_for_channel,
|
||||
get_miku_display_name,
|
||||
get_evil_miku_display_name
|
||||
get_evil_miku_display_name,
|
||||
get_persona_avatar_urls
|
||||
)
|
||||
|
||||
webhooks = await get_or_create_webhooks_for_channel(channel)
|
||||
@@ -891,9 +892,11 @@ This pushed things over the edge into a full argument."""
|
||||
|
||||
webhook = webhooks["evil_miku"] if persona == "evil" else webhooks["miku"]
|
||||
display_name = get_evil_miku_display_name() if persona == "evil" else get_miku_display_name()
|
||||
avatar_urls = get_persona_avatar_urls()
|
||||
avatar_url = avatar_urls.get("evil_miku") if persona == "evil" else avatar_urls.get("miku")
|
||||
|
||||
try:
|
||||
await webhook.send(content=content, username=display_name)
|
||||
await webhook.send(content=content, username=display_name, avatar_url=avatar_url)
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending as {persona}: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user