Skip to main content

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.

PyPI Python License Size

🔧 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")

# 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")

# Send embed message with multiple fields
hook.send_embedded_field(names=["Username", "Score", "Level"], values=["Player 1", "1500", "5"], inline=[True, True, False])

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


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.4.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplehook-1.4.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file simplehook-1.4.0.tar.gz.

File metadata

  • Download URL: simplehook-1.4.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for simplehook-1.4.0.tar.gz
Algorithm Hash digest
SHA256 1374f63e30c440701bf8929f37120841e5760f067eda166ac0f430e34475c3e1
MD5 6ff4afc656e4431c8509c91c2a09f750
BLAKE2b-256 ced788b5ad689d2b9237d8a150fff1559a2b1f4d3b4460e75f8c55cb41f9a64e

See more details on using hashes here.

File details

Details for the file simplehook-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: simplehook-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for simplehook-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 866f5ea1c99cff3f00525896f1eda46df23641f65ad691d116a4aa8ea52f0002
MD5 1a9f075b0c96caea23eec1062134d596
BLAKE2b-256 f5f310cfa9a4bf3a94a60333d6e1b5dcdbe6eac306db2c6f45276e1d3e326136

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