To send a post request to a discord webhook with an avatar in Python, you can use the requests
library. Follow these steps:
requests
module:main.py16 chars2 lines
main.py66 chars2 lines
Replace WEBHOOK_ID
with the ID of your webhook, and TOKEN
with the token of your webhook.
main.py97 chars5 lines
Replace Hello, world!
with the message you want to send, and https://example.com/avatar.png
with the URL of the avatar you want to send.
requests.post()
method:main.py52 chars2 lines
The json
parameter is used to pass the payload as a JSON object.
main.py112 chars5 lines
Here's the complete code:
main.py347 chars16 lines
gistlibby LogSnag