Skip to content

Repository files navigation

Clyde

PyPI version Supported Python versions Build status Coverage report PyPI downloads License

Build rich Discord Webhook API interactions with a typed Python API.

Clyde supports plain messages, Components, and rich Embeds for the Discord Webhook API. It validates each payload and sends it through synchronous or asynchronous HTTP methods.

Features

  • Type annotations across the public API
  • Input type and field validation with msgspec
  • Plain content, every webhook-compatible Discord Component, and field-level Embed controls
  • Helpers for Discord-flavored Markdown and timestamps
  • Synchronous and asynchronous HTTP requests through niquests
  • Automatic retries when Discord returns a rate limit
  • API documentation generated with Zensical

Installation

Important

Clyde requires Python 3.11 or later.

Add Clyde to a uv project:

uv add discord-clyde

Examples

Plain Message

from clyde import Webhook

Webhook(
    url="https://discord.com/api/webhooks/00000/XXXXXXXXXX",
    avatar_url="https://i.imgur.com/RzkhQgZ.png",
    username="Heisenberg",
    content="[Clyde](https://github.com/EthanC/Clyde) says hi!",
).execute()

Plain message preview

Message With Components

from clyde import Webhook
from clyde.components import ActionRow, LinkButton, TextDisplay

webhook = Webhook(
    url="https://discord.com/api/webhooks/00000/XXXXXXXXXX",
    avatar_url="https://i.imgur.com/BpcKmVO.png",
    username="TARS",
)

webhook.add_component(
    [
        TextDisplay(content="[Clyde](https://github.com/EthanC/Clyde) says hi!"),
        ActionRow(
            components=[
                LinkButton(
                    label="Try Clyde",
                    url="https://github.com/EthanC/Clyde",
                )
            ]
        ),
    ]
).execute()

Component message preview

Message With an Embed

from clyde import Embed, Webhook

Webhook(
    url="https://discord.com/api/webhooks/00000/XXXXXXXXXX",
    avatar_url="https://i.imgur.com/QaTHttz.png",
    username="Shady",
    embeds=[
        Embed(
            description="[Clyde](https://github.com/EthanC/Clyde) says hi!",
            color="#5865F2",
        )
    ],
).execute()

Embed message preview

Releases

Clyde loosely follows Semantic Versioning.

Contributing

Bug fixes and new features are welcome. Read the contribution guide before opening a pull request. Known bugs and feature requests are tracked in GitHub Issues.

Acknowledgments

Discord owns the Clyde character and Discord brand assets. This project is not affiliated with or endorsed by Discord.

Releases

Sponsor this project

Used by

Contributors

Languages