Skip to main content

discordwebhook.py

Downloads Downloads Version Discord

A python package for using discord webhooks. The only with asynchronous and synchronous options and fetching webhook information. A lightweight alternative to a full Discord API wrapper, just for webhooks.

For documentation see the readthedocs page For downloads see the PyPi page

For extra support join the Discord server

Installation

pip install discordwebhook.py

Examples

Basic example

import discordwebhook

# Create the webhook. 
webhook = discordwebhook.Webhook(
    url="webhook_url"
)

# Add embed with title "Embed title", same as discord.py
embed = discordwebhook.Embed(
    title="Embed title",
)

# Add a field to the embed, exactly the same as discord.py
embed.add_field(name="Field title", value="Exact same as discord.py, however is lighter", inline=False)

# Post webhook to URL synchronously. Can be await webhook.send_async to send asynchronously
webhook.send_sync(
    f"This is the message content!", # Webhook message content
    username="Coolo2", # Overwrite webhook username, can also be defined when class is initialized
    embed=embed # Embeds can also be set with embeds=[embed]
)

Fetch example

import discordwebhook 

webhook = discordwebhook.Webhook(
    url="webhook_url"
)

# Can be used synchronously and asynchronously with fetch_data_async. Returns current Webhook class
webhook.fetch_data_sync()

print(webhook.id)
print(webhook.url)

print(webhook.name)
print(webhook.icon_url)

print(webhook.channel_id)
print(webhook.guild_id)

Editing and deleting messages example

import discordwebhook 
import time

# Initialise the webhook object.
webhook = discordwebhook.Webhook(
    url="webhook_url"
)

# Send a message to the webhook
message = webhook.send_sync(
    content="The message content goes here"
)

time.sleep(1) # wait 1 second before editing

# Edit the message with new content, but keep the embed (as it is left empty)
message.edit_sync(
    content="New message content! It has been 1 second since the webhook was sent"
)

time.sleep(5) # wait 5 seconds before deleting

message.delete_sync()

Metadata

Release files for discordwebhook.py 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discordwebhook.py 1.1.2
File Size Uploaded Provenance
discordwebhook.py-1.1.2.tar.gz 9.4 kB Without provenance Details

Release files / discordwebhook.py-1.1.2.tar.gz

Download URL discordwebhook.py-1.1.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fb9eb7eefccfe83545f18eb05d5c3fffd4923e99624d6a84f7f12613a4fb842d
BLAKE2b-256 checksum
How to use checksums
53dc18f3d49fd366269c6ff043f394466e647aaacfa5e3e96dc787e0b55a87a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Security for discordwebhook.py 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page