Simple Discord webhook wrapper
Project description
SimpleHook
SimpleHook is a minimalistic Python wrapper for Discord webhooks. It allows you to easily send messages, files, and embedded content to a Discord channel using just a few lines of code.
🔧 Features
- Send plain text messages
- Customize username and avatar
- Mention users or everyone/here
- Use text-to-speech
- Use embeds
- Upload files and images
- Create and send polls
🚀 Usage
Import and setup
from simplehook import SimpleHook # or from simplehook import SimpleHookAsync
# Initialize with your webhook URL
hook = SimpleHook("https://discord.com/api/webhooks/your_webhook_url")
# or
hook = SimpleHookAsync("https://discord.com/api/webhooks/your_webhook_url")
Core functions
# Send a simple message
hook.send_message("Hello, world!")
# Send a file
hook.send_file("example.txt")
# Send a message with a custom username, avatar, and text-to-speech
hook.send_customized_message(
message="I'm a bot!",
username="CoolBot",
avatar_url="https://i.imgur.com/your_avatar.png",
tts=True
)
# Mention a user by ID or everyone/here
hook.send_customized_message(message="Look here!", mention="123456789012345678") # user mention
hook.send_customized_message(message="Attention!", mention="everyone") # @everyone
Embed functions
# Send embedded files (max 10)
hook.send_embedded_files(paths=["img1.png", "img2.jpg"], message="Check these out!", color=53231)
# Send embedded message
hook.send_embedded_message(title="Hello!", color=321)
# Send embedded author message
hook.send_embedded_author(name="Paul", avatar_url="https://i.imgur.com/your_avatar.png", description="How are you?😊")
# Send embedded URL with a custom title
hook.send_embedded_url(title="Google!", url="https://www.google.com")
# Send embedded image from the web
hook.send_embedded_url_image(url="https://i.imgur.com/your_image.png")
Poll function
# Create and send a poll
hook.create_poll(
question="What's your favorite color?",
answers=["Blue", "Red", "Green"],
emojis=["🔵", "🔴", "🟢"],
duration=48,
allow_multiselect=True
)
📦 Installation
pip install simplehook
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simplehook-1.3.1.tar.gz
(6.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplehook-1.3.1.tar.gz.
File metadata
- Download URL: simplehook-1.3.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed129494102389d662c12b33c733a12f0f2077bed209bef43671ff9e69029b04
|
|
| MD5 |
c5d6868bac47cb7c5afd8cae5aa696b5
|
|
| BLAKE2b-256 |
7ce71302be8b3dc7ae4babe493d661ca046989e10c26c936f2f9073b1522c383
|
File details
Details for the file simplehook-1.3.1-py3-none-any.whl.
File metadata
- Download URL: simplehook-1.3.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c408196698db67d89a5b5afd3811900b35ac05972833ac4d67b6fa88f86b4a5f
|
|
| MD5 |
c39a6a431e2bf4adf0921c579905967d
|
|
| BLAKE2b-256 |
b7ed571ddeb6c9923b89c3ce557df050a2d0e46d1f69025387e8b633c2917c63
|