Skip to main content

A clean, user-friendly Python package for sending Discord webhook messages and rich embeds.

Project description

webhookloggerx

A clean, user-friendly Python package for sending Discord webhook messages and rich embeds.

Installation

pip install webhookloggerx

Quick Start

from webhookloggerx import WebhookClient, Embed

client = WebhookClient("https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN")
client.send("Hello from webhookloggerx!")

Features

  • ✅ Send plain text messages
  • ✅ Send rich Discord embeds
  • ✅ Send multiple embeds in one request
  • ✅ Customise webhook display name & avatar
  • ✅ Embed builder with fluent (chainable) API
  • ✅ Built-in colour themes (success, error, warning, etc.)
  • ✅ Set embed title, description, author, footer, images, timestamp, fields

WebhookClient

Create a Client

from webhookloggerx import WebhookClient

client = WebhookClient("https://discord.com/api/webhooks/...")

Set Webhook Profile (name & avatar)

client.set_profile(
    username="MyBot",
    avatar_url="https://example.com/avatar.png"
)

Send a Plain Text Message

client.send("This is a plain message.")

Send an Embed

from webhookloggerx import Embed

embed = Embed().set_title("Hello!").set_description("Embed body here.")
client.send_embed(embed)

Send Multiple Embeds

embed1 = Embed().set_title("First").set_theme("success")
embed2 = Embed().set_title("Second").set_theme("error")
client.send_embeds([embed1, embed2])

Send Text + Embed Together

embed = Embed().set_title("Alert").set_description("Check this out!")
client.send_message(content="Hey team!", embed=embed)

Embed Builder

All methods return self, so you can chain them fluently.

Title & Description

embed = (
    Embed()
    .set_title("My Title")
    .set_description("This is the body of the embed.")
    .set_url("https://example.com")   # makes title clickable
)

Colour

# Hex string
embed.set_color("#FF5733")

# Integer
embed.set_color(16711680)

# Named theme
embed.set_theme("success")

Available themes:

Theme Colour
default Discord Blurple
success Green
warning Yellow
error Red
info Blue
dark Dark Grey
light White
purple Purple
orange Orange
pink Pink

Author

embed.set_author(
    name="Nur Mohammad Rafi",
    url="https://github.com/yourusername",
    icon_url="https://example.com/icon.png"
)

Thumbnail & Image

embed.set_thumbnail("https://example.com/thumb.png")  # top-right corner
embed.set_image("https://example.com/big-image.png")  # large bottom image

Fields

embed.add_field("Status", "Online", inline=True)
embed.add_field("Server", "Production", inline=True)
embed.add_field("Message", "All systems go.", inline=False)
  • inline=True — fields sit side by side (up to 3 per row)
  • inline=False — field takes the full width
  • Max 25 fields per embed

Footer

embed.set_footer("webhookloggerx v2.0", icon_url="https://example.com/icon.png")

Timestamp

embed.set_timestamp()        # use current UTC time
from datetime import datetime, timezone
embed.set_timestamp(datetime(2025, 1, 1, tzinfo=timezone.utc))  # custom time

Full Example

from webhookloggerx import WebhookClient, Embed

# Create and configure client
client = WebhookClient("https://discord.com/api/webhooks/...")
client.set_profile(username="AlertBot", avatar_url="https://example.com/bot.png")

# Build embed
embed = (
    Embed()
    .set_title("🚨 System Alert")
    .set_description("A critical event has been detected on the server.")
    .set_theme("error")
    .set_author("Monitor System", icon_url="https://example.com/icon.png")
    .set_thumbnail("https://example.com/thumb.png")
    .add_field("Host", "prod-server-01", inline=True)
    .add_field("Status", "❌ Down", inline=True)
    .add_field("Region", "US-East", inline=True)
    .add_field("Details", "Connection timeout after 30s", inline=False)
    .set_image("https://example.com/graph.png")
    .set_footer("webhookloggerx • Auto-alert system")
    .set_timestamp()
)

# Send it
client.send_embed(embed)

Error Handling

from webhookloggerx import WebhookClient, WebhookError

client = WebhookClient("https://discord.com/api/webhooks/...")

try:
    client.send("Test message")
except WebhookError as e:
    print(f"Failed: HTTP {e.status_code}{e.message}")

API Reference

WebhookClient

Method Description
__init__(url) Create client with webhook URL
set_profile(username, avatar_url) Override display name & avatar
send(content) Send plain text message
send_embed(embed) Send a single Embed
send_embeds(embeds) Send a list of Embeds (max 10)
send_message(content, embed) Send text + embed together

Embed

Method Description
set_title(title) Embed title
set_description(text) Embed body text
set_url(url) Make title a hyperlink
set_color(color) Hex string or int
set_colour(color) Alias for set_color
set_theme(theme) Named colour theme
set_author(name, url, icon_url) Author block
set_thumbnail(url) Small top-right image
set_image(url) Large bottom image
set_footer(text, icon_url) Footer text & icon
set_timestamp(dt) Timestamp (default: now)
add_field(name, value, inline) Add a field
clear_fields() Remove all fields
build() Return raw dict for API

License

MIT © Nur Mohammad Rafi

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

webhookloggerx-2.0.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

webhookloggerx-2.0.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file webhookloggerx-2.0.2.tar.gz.

File metadata

  • Download URL: webhookloggerx-2.0.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for webhookloggerx-2.0.2.tar.gz
Algorithm Hash digest
SHA256 dc477ae854643da5ff7e978e9f307f4e9e5fed93785c8258c7d569e45db53cef
MD5 621e3e84939126a3942fc8c332ef9000
BLAKE2b-256 2350e61ea88cf96f7d81cb0b507a0a45a86eb754f723e2fd3bfc5a9a456f8c89

See more details on using hashes here.

File details

Details for the file webhookloggerx-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: webhookloggerx-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for webhookloggerx-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a5e12fee0450072f480bf010b0723e27f3735b2cc0e7196719e8656e7ca0235d
MD5 456540901d3fc44f033d12fbc54ebfd8
BLAKE2b-256 c31f9caf2cf37c536bf4522ce4e5d033488d056e23030ab88248885cb9174fdd

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