This time I would like to play with Discord's Webhook.
Open "Edit Channel" on the right side of the channel name.
Click Web Hook from the sidebar to open it.
Click "Create Webhook" in the upper right.
Leave the name and icon as they are. (To play later) Click the "Copy" button in the Webhook URL section. Then click the save button.
webhook.py
from discordwebhook import Discord #Loading Discord Webhook
discord = Discord(url="") #④ Paste the URL you copied when creating the Webhook
discord.post(
content="Whebohook's sword, oh oh oh oh oh oh oh oh oh oh", #The contents of the message
username="Webhook", #username
avatar_url="https://pbs.twimg.com/profile_images/1201406146822557696/ewFFvnAa_200x200.jpg " #Icon URL
)
When you run it, it looks like this!
Recommended Posts