Allow us to send base64 Uri images instead of urls for avatar_url (webhooks)
2
-
This is not a perfect solution but I found how to change avatar with base64
first, you need base64 as string variable that has prefix 'data:image/png;base64,'.
then, requests with patch method following this https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token
example)
Python
image_base64 = "data:image/jpg;base64,/9j/4AAQSkZJRgAB..."
webhook_url = "your webhook url contains token" # url/webhooks/{webhook.id}/{webhook.token}
mod_webhook_data['name'] = "change webhook name if you want"
mod_webhook_data['avatar'] = image_base64
try:
requests.patch(webhook_url, json=mod_webhook_data)
except Exception as e:
print("error: ", e)This will change webhook name and avatarthen, use post method to send message0
Iniciar sesión para dejar un comentario.
Comentarios
1 comentario