DiscoHooks is a simple python library to use discord webhooks.
https://pypi.org/project/discohooks/
- Send Message To Webhook
- Send File To Webhook
- Send Embed To Webhook
- Delete Webhook
- Customize Webhook
- Get Webhook Informations
- Use multiple webhooks
The requests library is required.
# Install Requests Lib
pip install requests
#Install Discohooks Lib
pip install discohooks
First, import the library :
from discohooks import Webhook
- Send Message :
from discohooks import Webhook
hook = Webhook(["webhook_url_1", "webhook_url_2"])
# Even if you're using only one webhook, still use the [ ]
hook.send(content="Hello Word!")
- Delete Webhook :
from discohooks import Webhook
hook = Webhook(["webhook_url_1", "webhook_url_2"])
# Even if you're using only one webhook, still use the [ ]
hook.delete()
- Customize Webhook :
from discohooks import Webhook
hook = Webhook(["webhook_url_1", "webhook_url_2"])
# Even if you're using only one webhook, still use the [ ]
hook.customize(name="WEBHOOK_NAME", avatar="AVATAR_URL")
# If you want, you can choose to take only one of the two.
- Get Webhook Informations :
from discohooks import Webhook
hook = Webhook(["webhook_url_1", "webhook_url_2"])
# Even if you're using only one webhook, still use the [ ]
info = hook.info(["name", "id"])
print(info)
These are just two examples; here are all the retrievable pieces of information:
application_id, avatar, channel_id, guild_id, id, name, type, token, url
- Send File :
from discohooks import Webhook
hook = Webhook(["webhook_url_1", "webhook_url_2"])
# Even if you're using only one webhook, still use the [ ]
hook.send_file("YOUR_FILE")
First, import the library :
from discohooks import Webhook, Embed
embed = Embed(title='Title', description='Description', color=0xFF5733)
embed.add_field(name='Field 1', value='Value 1', inline=False)
embed.add_field(name='Field 2', value='Value 2', inline=True)
embed.set_thumbnail(url='https://example.com/thumbnail.jpg')
embed.set_image(url='https://example.com/image.jpg')
embed.set_footer(text='Footer text', icon_url='https://example.com/footer_icon.jpg')
hook.send(embed=embed)
# Here's everything you can put in your webhook's embed.