Discordit
Send Discord messages through an incoming webhook. Use it as a library or as
the discordit command. A successful post returns when Discord answers
HTTP 204.
Install
Requires Python 3.13 or newer, and a Discord incoming webhook URL you are allowed to post to.
pip install lupaxa-discordit
discordit --help
Put the webhook URL in the environment, or in a profile, rather than in shell history.
CLI
discordit --webhook "$DISCORD_WEBHOOK_URL" --text "Hello"
discordit --profile testing --text "Hello"
discordit -p alerts --config "$HOME/work/discordit.yml" --text "Disk full"
discordit --webhook "$DISCORD_WEBHOOK_URL" --file report.txt --text "see attached"
discordit --webhook "$DISCORD_WEBHOOK_URL" --embed '{"title":"Hi"}' --tts
discordit --webhook "$DISCORD_WEBHOOK_URL" --thread-name Incident --text started
discordit --webhook "$DISCORD_WEBHOOK_URL" --allowed-mentions '{"parse":[]}' --text "no pings"
discordit --profile testing --validate
python -m lupaxa.discordit --version
The webhook URL must use Discord's
/api/webhooks/
path. Pass --webhook, or --profile with a webhook_url in the config
file.
--text, --embed, and --file may be combined. --validate cannot be
combined with them. One of those four is required. Flags override the same
fields from the selected profile. --timeout must be greater than 0.
Escaped newlines in --text are sent as real line breaks, so Hello\\nthere
arrives as two lines. Content longer than 2000 characters is an error.
--validate probes the webhook, then posts This is a validation message
plus username and avatar when those are set. It does not send text-to-speech,
a thread name, or allowed mentions.
| Flag | Default | Description |
|---|---|---|
--webhook, -w |
profile value | Discord webhook URL |
--profile, -p |
— | Profile name in the config file |
--config |
~/.discordit.yml |
Config file path |
--text, -t |
— | Message content |
--embed |
— | One embed as a JSON object |
--file |
— | One file path |
--validate |
— | Probe the URL, then post a validation message |
--username, -u |
profile value | Display name |
--avatar-url |
profile value | Avatar URL |
--tts / --no-tts |
profile, else false | Text-to-speech |
--thread-name |
profile value | Forum thread name |
--allowed-mentions |
profile value | Allowed-mentions JSON object |
--timeout, -T |
10 |
Request timeout in seconds |
--version |
— | Print the package version and exit |
Config
Profiles live in $HOME/.discordit.yml. Pass --config to use another
file. --config requires --profile.
profiles:
testing:
webhook_url: https://discord.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN
username: PyBot
avatar_url: https://example.com/avatar.png
tts: false
thread_name: Alerts
allowed_mentions:
parse: []
timeout: 15
The file must contain a profiles mapping. Unknown keys are rejected.
| Field | Required | Meaning |
|---|---|---|
webhook_url |
unless --webhook is passed |
Discord webhook URL |
username |
no | Display name, 1–80 characters |
avatar_url |
no | Avatar URL |
tts |
no | Text-to-speech; default false |
thread_name |
no | Forum thread name, 1–100 characters |
allowed_mentions |
no | Allowed-mentions mapping |
timeout |
no | Request timeout in seconds; default 10 |
Library
from lupaxa.discordit import Discordit, load_profile
profile = load_profile("testing")
client = Discordit(
profile.webhook_url,
username=profile.username,
avatar_url=profile.avatar_url,
tts=profile.tts or False,
thread_name=profile.thread_name,
allowed_mentions=profile.allowed_mentions,
timeout=profile.timeout or 10.0,
)
client.send_message("Hello from a profile")
client.send_embed('{"title": "Hello"}')
client.send_file("report.txt", content="see attached")
client.validate()
send is an alias of send_message. Username, avatar URL, text-to-speech,
thread name, and allowed mentions are added when you set them and the payload
does not already include that field. send_payload posts a JSON object, with
an optional file. A Discord HTTP 204 response returns True.
load_profile reads $HOME/.discordit.yml when no path is given. A missing
file, unknown profile, or invalid YAML raises ConfigError. validate
returns False when the probe does not succeed.
Exit codes
| Code | When |
|---|---|
0 |
Help, version, or Discord accepted the post |
1 |
The webhook was rejected, or the post failed |
2 |
Command-line usage, a bad config, or argument parsing failed |
Development
make init
make python-install-dev
make python-check
Metadata
Release files for lupaxa-discordit 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lupaxa_discordit-0.1.4.tar.gz | 10.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lupaxa_discordit-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / lupaxa_discordit-0.1.4.tar.gz
| Download URL | lupaxa_discordit-0.1.4.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
167c54a8dc99d49c6ddf19454d2cca9791007f76c0f28babc8d3f311490fa1aa
|
|
BLAKE2b-256 checksum How to use checksums |
8306d1d7340f15aa0d586f166c39d23c236f5a3d6e4364138cff0c0c3e1caa28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / lupaxa_discordit-0.1.4-py3-none-any.whl
| Download URL | lupaxa_discordit-0.1.4-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6ca3172d7d3f65fbea3a52080146dcdc0cccef8b7f0830b54f6e881cf70a2f7
|
|
BLAKE2b-256 checksum How to use checksums |
5a61aa5b0e089c36ea2984842ec1696e3e49918f898a3eaef15b0aa0be99e1b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency log