Skip to main content

A simple library for interacting with Discord webhooks

Project description

DiscoHooks

Projet Description

DiscoHooks is a simple python library to use discord webhooks.

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 reqests

#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.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discohooks-1.0.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file discohooks-1.0.tar.gz.

File metadata

  • Download URL: discohooks-1.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for discohooks-1.0.tar.gz
Algorithm Hash digest
SHA256 4e8f493371d54d06b555af077042ac82b87f458a346c3dcdba911fbe3db0ff76
MD5 5026965c4065eeffcdde54c0905c7c64
BLAKE2b-256 0b355fe195d437e349d8d4c7130c1c1e7e228b037c5646e933d80ce207559cbb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page