Metadata-Version: 2.1
Name: discordwebhook.py
Version: 1.0.1
Summary: Easily using discord webhooks in python - asynchronous and synchronous - documented at https://discordwebhook.readthedocs.io/en/latest/
Home-page: https://github.com/Coolo22/discordwebhook.py
Author: Coolo2
Author-email: itsxcoolo2@gmail.com
License: MIT
Download-URL: https://github.com/Coolo22/discordwebhook.py/raw/master/Archive/discordwebhook.py-1.0.1.tar.gz
Project-URL: Documentation, https://discordwebhook.readthedocs.io/en/latest
Project-URL: Issue tracker, https://github.com/Coolo22/discordwebhook.py/issues
Keywords: discord,webhook,python,simple,post,asynchronous,synchronous
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# discordwebhook.py

[![Downloads](https://pepy.tech/badge/discordwebhook-py)](https://pepy.tech/project/discordwebhook-py)
[![Downloads](https://pepy.tech/badge/discordwebhook-py/month)](https://pepy.tech/project/discordwebhook-py)
![Version](https://img.shields.io/pypi/v/discordwebhook.py)
![Discord](https://img.shields.io/discord/937336250191458334?label=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](https://discordwebhook.readthedocs.io/en/latest/)
For downloads see the [PyPi page](https://pypi.org/project/discordwebhook.py/)

For extra support join [the Discord server](https://discord.gg/5EhsXvShBE)



# Installation
```pip install discordwebhook.py```


## Examples

### Basic synchronous example
```python
import discordwebhook

# Create the webhook. Parameter url="webhook_url" can be added here instead of in method .sendSync()
webhook = discordwebhook.Webhook(
    url="webhook_url"
)

# OPTIONAL - Get webhook username and avatar (sends request to discord)
webhook_data = webhook.fetch_data_sync()

# 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 can be used synchronously", inline=False)

# Post webhook to URL synchronously. Use await webhook.send_async to send asynchronously
webhook.send_sync(
    f"This webhook's original username was **{webhook_data.username}**", # 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
```python
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)
```


