--- name: discord-client description: "Interact with Discord via a bot: read channels, send messages, list guilds/channels, upload files, manage threads. Uses the Discord REST API with a bot token stored in ~/.zeebot/api_keys/discord.txt." disable-model-invocation: true argument-hint: "[action, e.g. 'read messages in #general' or 'send hello to channel 123']" allowed-tools: Read, Grep, Bash, Glob, Write --- # Discord Client Use this skill to interact with Discord via the bot account. ## Quick Reference All commands use the helper script at `/Users/z80/dev/lemon/.claude/skills/discord-client/discord_api.py`. Run via `uv` so no install is needed: ```bash SCRIPT="/Users/z80/dev/lemon/.claude/skills/discord-client/discord_api.py" uv run --with httpx python "$SCRIPT" [args] ``` ### Commands | Command | Description | |---------|-------------| | `me` | Show bot info | | `guilds` | List all servers the bot is in | | `channels ` | List channels in a server | | `read [--limit N] [--before ID] [--after ID]` | Read messages (default 50, oldest first) | | `send "message"` | Send a message | | `reply "text"` | Reply to a message | | `edit "new text"` | Edit a bot message | | `delete ` | Delete a message | | `react ` | Add a reaction | | `upload [--caption "text"]` | Upload a file | | `threads ` | List threads | | `thread-create "name"` | Create a thread | | `members [--limit N]` | List server members | ## Workflow 1. **Discover**: Run `guilds` to find the guild ID, then `channels ` to find channel IDs. 2. **Read**: Run `read ` to see recent messages. Use `--limit`, `--before`, `--after` to paginate. 3. **Act**: Use `send`, `reply`, `edit`, `delete`, `react`, `upload` as needed. ## Token The bot token is loaded automatically from `~/.zeebot/api_keys/discord.txt` (field: `bot_token`). - NEVER print, echo, or commit the token. - NEVER include the token in scripts written to disk. - The helper script reads it at runtime from the secrets file. ## Notes - The bot can only act in servers/channels it has been invited to with appropriate permissions. - Message content requires the **Message Content Intent** to be enabled in the Discord Developer Portal. - The bot can read messages from other bots and users. - Rate limits: Discord enforces per-route rate limits. The script will get HTTP 429 if you hit them — back off and retry. - Max message length: 2000 characters. For longer content, split into multiple messages or upload as a file. ## Custom Scripts For operations not covered by the CLI, write a temporary Python script that imports the helpers: ```python import sys sys.path.insert(0, "/Users/z80/dev/lemon/.claude/skills/discord-client") from discord_api import load_token, api_get, api_post, BASE token = load_token() # ... custom API calls ``` If `$ARGUMENTS` is provided, perform the requested Discord action.