Discord CLI for local-first sync, search, export, and agent-friendly retrieval
Project description
discord-cli
More Projects
- xiaohongshu-cli — Xiaohongshu (小红书) CLI for notes and account workflows
- twitter-cli — Twitter/X CLI for timelines, bookmarks, and posting
- bilibili-cli — Bilibili CLI for videos, users, search, and feeds
- tg-cli — Telegram CLI for local-first sync, search, and export
Telethon-style local-first tooling for Discord: sync messages into SQLite, search them from the terminal, export structured results, and feed them to AI agents.
discord-cli uses the Discord HTTP API with a user token from your local session. It is meant for accounts you control, on machines you control.
Warning
- discord-cli reads a Discord user token from your local Discord/browser session.
- Discord may restrict or suspend accounts that automate user-token traffic.
- Use it only on your own account and only if you understand the risk.
Features
- Local-first SQLite storage for history, sync, search, export, and analytics
discord dc sync-alldiscovers accessible text channels and bootstraps from the API- Query commands support
--yamland--jsonfor scripting and AI agent integration - Non-TTY stdout defaults to YAML; override with
OUTPUT=yaml|json|rich|auto - Structured output contract: SCHEMA.md
AI Agent Tip: Prefer
--yamlfor structured output unless a strict JSON parser is required. Use-nto limit results.
- Optional Claude-powered
analyzeandsummary - Safer local channel resolution for
search,recent,today,export, andpurge
Installation
# PyPI
uv tool install kabi-discord-cli
# or
pipx install kabi-discord-cli
# With AI commands
uv tool install 'kabi-discord-cli[ai]'
# From GitHub
uv tool install git+https://github.com/jackwener/discord-cli.git
# From source
git clone git@github.com:jackwener/discord-cli.git
cd discord-cli
uv sync --extra dev
Upgrade to the latest version:
uv tool upgrade kabi-discord-cli
# Or: pipx upgrade kabi-discord-cli
Tip: Upgrade regularly to avoid unexpected errors from outdated API handling.
AI commands require the optional ai extra plus ANTHROPIC_API_KEY.
Quick Start
# Extract and save a token from your local Discord/browser session
discord auth --save
# Verify auth
discord status
discord whoami
# Explore guilds and channels
discord dc guilds
discord dc channels <guild_id>
# Bootstrap local storage
discord dc sync-all -n 500
# Query local cache
discord today
discord recent -n 50
discord search "rust" -c general --json
discord timeline --by hour --json
Commands
Auth & Account
| Command | Description |
|---|---|
auth [--save] |
Extract a token from local Discord/browser session |
status |
Check if the configured token is valid |
whoami [--json] |
Show the current Discord profile |
Discord API (discord dc ...)
| Command | Description |
|---|---|
dc guilds [--json] |
List joined guilds |
dc channels GUILD [--json] |
List text channels in a guild |
dc history CHANNEL [-n 1000] |
Fetch message history for one channel |
dc sync CHANNEL [-n 5000] |
Incrementally sync one channel |
dc sync-all [-n 5000] |
Discover and sync accessible text channels |
dc tail CHANNEL [--once] |
Poll and follow new messages like tail -f |
dc search GUILD KEYWORD [-c CHANNEL_ID] [--json] |
Use Discord native search |
dc members GUILD [--max 50] [--json] |
List guild members |
dc info GUILD [--json] |
Show guild info |
Local Query
| Command | Description |
|---|---|
search KEYWORD [-c CHANNEL] [-n 50] [--json] |
Search locally stored messages |
recent [-c CHANNEL] [--hours N] [-n 50] [--json] |
Show newest locally stored messages |
stats [--json] |
Message statistics per channel |
today [-c CHANNEL] [--json] |
Show today's messages |
top [-c CHANNEL] [--hours N] [--json] |
Top senders |
timeline [-c CHANNEL] [--hours N] [--by day|hour] [--json] |
Activity timeline |
Data & AI
| Command | Description |
|---|---|
export CHANNEL [-f text|json] [-o FILE] [--hours N] |
Export stored messages |
purge CHANNEL [-y] |
Delete stored messages for a channel |
analyze CHANNEL [--hours 24] [-p PROMPT] |
Claude analysis for one channel |
summary [-c CHANNEL] [--hours N] |
Claude summary across today or last N hours |
Behavior Notes
- Most top-level query commands read from local SQLite, not directly from Discord.
discord dc sync-allnow bootstraps by discovering guilds and channels through the API, so it works on a fresh database.- Channel names are resolved against the local database. If a name matches multiple channels, the CLI will stop and ask you to use a more specific name or a channel ID.
AI Usage
Install AI support first:
uv sync --extra ai
export ANTHROPIC_API_KEY=...
Then:
discord analyze general --hours 24
discord summary --hours 12
discord search "release" --json
discord-cli also ships with SKILL.md for agent integration.
Development
uv sync --extra dev --extra ai
uv run ruff check .
uv run python -m pytest
uv build
License
Apache-2.0
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kabi_discord_cli-0.2.7.tar.gz.
File metadata
- Download URL: kabi_discord_cli-0.2.7.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a8b59538370216dedda866b885df9101a9791441ab1770aa4ff642074116319
|
|
| MD5 |
0402e65ed1ba01971422e7fb8091aa1a
|
|
| BLAKE2b-256 |
e8e61a7d3194526f11da631c552722098b508f29aba018a9ffdc3794fad90bc5
|
Provenance
The following attestation bundles were made for kabi_discord_cli-0.2.7.tar.gz:
Publisher:
publish.yml on jackwener/discord-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kabi_discord_cli-0.2.7.tar.gz -
Subject digest:
4a8b59538370216dedda866b885df9101a9791441ab1770aa4ff642074116319 - Sigstore transparency entry: 1078951610
- Sigstore integration time:
-
Permalink:
jackwener/discord-cli@91a420ca564a6d81e3e4c32a825d0765aacd0373 -
Branch / Tag:
refs/tags/v0.2.7 - Owner: https://github.com/jackwener
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@91a420ca564a6d81e3e4c32a825d0765aacd0373 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kabi_discord_cli-0.2.7-py3-none-any.whl.
File metadata
- Download URL: kabi_discord_cli-0.2.7-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eddc3954726e077f0a2dd4cd09d4a8410a1a842110b368883629dc00aec2eb8d
|
|
| MD5 |
6bebdf698cafcf75dfad3bc831c8b8e6
|
|
| BLAKE2b-256 |
2ba81d359448273ef08c8a30e5d28df0212aebb7ad8f9d5d3d500ac2f6220c53
|
Provenance
The following attestation bundles were made for kabi_discord_cli-0.2.7-py3-none-any.whl:
Publisher:
publish.yml on jackwener/discord-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kabi_discord_cli-0.2.7-py3-none-any.whl -
Subject digest:
eddc3954726e077f0a2dd4cd09d4a8410a1a842110b368883629dc00aec2eb8d - Sigstore transparency entry: 1078951618
- Sigstore integration time:
-
Permalink:
jackwener/discord-cli@91a420ca564a6d81e3e4c32a825d0765aacd0373 -
Branch / Tag:
refs/tags/v0.2.7 - Owner: https://github.com/jackwener
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@91a420ca564a6d81e3e4c32a825d0765aacd0373 -
Trigger Event:
push
-
Statement type: