Skip to main content

discord-tools

A local CLI for operating your Discord bot: discover server/channel/thread IDs, search and export messages, send messages, create channels and threads, clear messages, and manage the bot's settings — with a guided setup that walks you through the Discord Developer Portal (the BotFather it never had).

Sibling of telegram-tools: same menu for humans, same subcommands for agents, same safety gates on anything destructive. Bot-token auth only — no self-bots, ever (Discord ToS).

Install

pip install discord-tools-cli
discord-tools auth      # guided bot setup: portal walkthrough, token check, invite URL
discord-tools doctor    # verify token, message-content intent, servers, permissions

(The PyPI name is discord-tools-cli — plain discord-tools is squatted by an unrelated, archived package. The installed command is discord-tools.)

Python 3.11+. Bare discord-tools opens a looping menu for humans; agents and scripts pass a subcommand.

Commands

Command What it does
auth Guided Developer Portal setup; verifies the token and the message-content intent, stores the token as a named profile, prints the invite URL
doctor Checks Python, config, token, intent, joined servers; --channel <id> adds per-channel permission checks and a message-visibility probe
discover Prints the server → channel → thread tree with every ID; --server <id> narrows, --json <path> writes a file
search Searches a channel/thread's history locally (Discord gives bots no search API): --keyword, --from-user, --since, --until, --limit; --output <name> exports JSON/CSV
send Posts as the bot after a full-message preview + y/N; --yes skips the prompt only for channels in DISCORD_SEND_ALLOWLIST
create channel / category / thread, each behind a confirmation
clear-messages Dry-run by default; deleting for real takes --execute and typing DELETE. The dry-run reports which messages fall inside Discord's 14-day bulk window and which will delete one-by-one (slower)
bot Shows the active profile's bot (username, description, avatar, intent, invite URL); edits go behind a diff + confirm

Profiles: a bot per agent

Tokens live in ~/.discord-tools/.env (mode 0600) as named profiles:

DISCORD_BOT_TOKENS=default:token-a,dobby:token-b

--profile dobby (before the subcommand) selects one; DISCORD_TOOLS_PROFILE sets the default; DISCORD_TOKEN overrides everything. auth writes this file for you — run it once per bot.

DISCORD_SEND_ALLOWLIST is a comma-separated list of channel/thread IDs that send --yes may post to. Unset means every unattended send is refused — each destination is opted in by hand.

Exports stay out of your repos

Relative --output names land in ~/.discord-tools/exports/, never the working directory. Message text coming back empty on every message means the message-content intent is off in the portal — doctor names it and auth walks you through enabling it.

For agents

skill/SKILL.md is a bundled agent skill describing the CLI surface and the rules an agent must follow (never clear-messages, allowlist-gated sends, never print tokens). It updates in the same commit as any CLI-surface change.

Development

python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest    # no network, no real token

MIT. See SPEC.md for the v1 contract and CHANGELOG.md for history.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord_tools_cli-0.1.0.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

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

discord_tools_cli-0.1.0-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file discord_tools_cli-0.1.0.tar.gz.

File metadata

  • Download URL: discord_tools_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for discord_tools_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1513bf910addf9dfd46e863ab2fd7b1e309f4eba7f56cc2c363f511c4d4bf4c1
MD5 9be5e17b61586850bea1b48b773aa602
BLAKE2b-256 62fd3abc0cceb34bcce5e819d10c72747eb364748263ab0632c16b5061b0db43

See more details on using hashes here.

File details

Details for the file discord_tools_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for discord_tools_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a5c1b043e04ba81a211186379da40208dfb18975ca5c49c4fc7bd3ae981876d
MD5 4b339fb1346c28423df6beb7df505354
BLAKE2b-256 33a940119b5e66067acaea955f175769fc9d40512c244cf6870a9644e38b9b38

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page