Skip to main content

discord-bot-cli

Agent + CLI that gives an agent Discord access via a bot.

What you get

  • An agent-first CLI cited from teken (afi-cli) — the runtime package has no third-party dependencies.
  • A mesh identityculture.yaml (suffix + backend) and the matching prompt file (CLAUDE.md for backend: claude).
  • The canonical guildmaster skill kit (11 skills) under .claude/skills/, vendored cite-don't-import. See docs/skill-sources.md.
  • A build + deploy baseline — pytest, lint, the agent-first rubric gate, and PyPI Trusted Publishing wired into GitHub Actions.

Quickstart

uv sync
uv run pytest -n auto                 # run the test suite
uv run discord-bot-cli whoami  # identity from culture.yaml
uv run discord-bot-cli learn   # self-teaching prompt (add --json)
uv run teken cli doctor . --strict    # the agent-first rubric gate CI runs

CLI

Introspection verbs

Verb What it does
whoami Report this agent's nick, version, backend, and model from culture.yaml.
learn Print a structured self-teaching prompt.
explain <path> Markdown docs for any noun/verb path.
overview Read-only descriptive snapshot of the agent.
doctor Check the agent-identity invariants (prompt-file-present, backend-consistency).
cli overview Describe the CLI surface itself.

Every command supports --json. Results go to stdout, errors/diagnostics to stderr (never mixed). Exit codes: 0 success, 1 user error, 2 environment error, 3+ reserved.

Discord verbs

Give an agent Discord access through a bot. These need a bot token and the optional discord extra (which pulls in discord.py):

uv pip install 'discord-bot-cli[discord]'   # or: pip install 'discord-bot-cli[discord]'
export DISCORD_BOT_TOKEN=...                 # read from the env, never a flag
Verb What it does
channel list <guild_id> List a guild's channels.
channel messages <channel_id> [--limit N] Read the last N messages (1–100, default 20).
channel messages <channel_id> --since W [--limit N] Read a time window, paging past the 100-message cap. W is an ISO 8601 timestamp, a date (2026-06-01, midnight UTC), or a duration (90d). --limit becomes a safety ceiling.
message post <channel_id> [content] [--file PATH]... Post a message, optionally with attachments; returns its id.
message reply <channel_id> <message_id> [content] [--file PATH]... Reply to a message, optionally with attachments.
message react <channel_id> <message_id> <emoji> Add a reaction.
thread create <channel_id> --name <name> [--message <id>] Create a thread (anchored or standalone).
thread post <thread_id> [content] [--file PATH]... Post into a thread, optionally with attachments.
user get <user_id> [<user_id> ...] [--ids-file <path>|-] Look up one or more users. --json is always an array.

Each verb is one-shot: it connects, performs one action, and exits (no daemon, no gateway subscription). post/reply/thread create return the created id in --json so output composes into the next call. A missing token or the absent extra exits 2 with a hint; bad ids exit 1.

# discover, read, write, compose
discord channel list 1234567890 --json
discord channel messages 1234567890 --limit 50 --json
MSG=$(discord message post 1234567890 "hello" --json | python3 -c 'import sys,json;print(json.load(sys.stdin)["id"])')
discord message react 1234567890 "$MSG" 👍

# attach files (repeatable; content optional when a file is given)
discord message post 1234567890 "weekly report" --file chart.svg --file table.png --json

# read a real time window, then batch-resolve the authors in one login
discord channel messages 1234567890 --since 90d --json > scan.json
python3 -c 'import json;print("\n".join({m["author"]["id"] for m in json.load(open("scan.json"))["messages"] if not m["author"]["bot"]}))' \
  | discord user get --ids-file - --json

--since reads carry a window object in --json{since, limit, message_count, fully_covered, stopped_by} — so a caller can tell a truncated scan from a complete one rather than guessing. Two things to know before reaching for --file: it is an unsandboxed local read (any path the process can open is uploaded to Discord — the operator owns which paths reach it), and the returned attachment url is a reference, not storage: it a signed CDN link that expires roughly 24h after it is issued, and 404s outright once the message is deleted — re-fetch the message for a fresh one.

The runtime package itself stays dependency-free — discord.py is imported lazily inside the verb handlers, so a plain install never pulls it in.

Live Discord tests

uv run pytest never talks to real Discord — the whole suite runs against a stubbed client. tests/test_live_discord.py is a separate, opt-in lane (marker live) that drives the real bot; it self-skips unless both DISCORD_LIVE_TESTS=1 and DISCORD_BOT_TOKEN are set. These tests leave permanent artifacts — messages, replies, reactions, threads, and a real message post --file upload — because there is no delete verb, so always point DISCORD_TEST_CHANNEL_ID at a disposable sandbox channel, never a real one. See CLAUDE.md for the full env-var list and how to run them.

Make it your own

  1. Rename the package discord_bot_cli/ and the discord-bot-cli CLI/dist name throughout pyproject.toml, the package, tests/, sonar-project.properties, and this README.md. The name is hard-coded in ~100 places, so list every occurrence first — see the git grep discovery command in CLAUDE.md, the authoritative rename procedure.
  2. Edit culture.yaml with your suffix and backend.
  3. Rewrite CLAUDE.md for your agent and run /init.
  4. Re-vendor only the skills you need from guildmaster (see docs/skill-sources.md).

See CLAUDE.md for the full conventions (version-bump-every-PR, the cicd PR lane, deploy setup).

License

MIT — see LICENSE.

Download files

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

Source Distribution

discord_bot_cli-0.7.0.tar.gz (316.1 kB view details)

Uploaded Source

Built Distribution

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

discord_bot_cli-0.7.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file discord_bot_cli-0.7.0.tar.gz.

File metadata

  • Download URL: discord_bot_cli-0.7.0.tar.gz
  • Upload date:
  • Size: 316.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for discord_bot_cli-0.7.0.tar.gz
Algorithm Hash digest
SHA256 a1373cff5d5c8076653a4f6bd60cff05acb73f8a41ef53b81e3ebe27d215c21b
MD5 97bbc5bf8f3dd49fb939d4c5d26f38f6
BLAKE2b-256 f9b19afe6c04e13bf9caf04284e9e5e058c4eeb9b0bfeb560cd7bca442211e81

See more details on using hashes here.

File details

Details for the file discord_bot_cli-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: discord_bot_cli-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for discord_bot_cli-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64209be3013266df619e967be0df46f68d2683dbdaf63d0c4d99c82041e553fa
MD5 4220c8c2d3957f802fd21beaab78b27a
BLAKE2b-256 c1be2b95dad70952f1d12a48592d91b239f17b18de8ddcb9e544aabcf50e5257

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

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