8000 GitHub - Nyxoy201/discohooks: A simple library for interacting with Discord webhooks
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Nyxoy201/discohooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiscoHooks

Projet Description

DiscoHooks is a simple python library to use discord webhooks.

https://pypi.org/project/discohooks/

Lib Features

  • Send Message To Webhook
  • Send File To Webhook
  • Send Embed To Webhook
  • Delete Webhook
  • Customize Webhook
  • Get Webhook Informations
  • Use multiple webhooks

Installing

The requests library is required.

# Install Requests Lib
pip install requests

#Install Discohooks Lib
pip install discohooks

How To Use

To use the library without embed :

First, import the library :

from discohooks import Webhook
  1. 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!")
  1. 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()
  1. 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.
  1. 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

  1. 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")

To use the library witht embed :

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.

About

A simple library for interacting with Discord webhooks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0