-
Notifications
You must be signed in to change notification settings - Fork 0
Discord Send CLI
Rina edited this page May 12, 2026
·
1 revision
discord-send is a zero-dependency CLI that Claude Code uses to send messages back to Discord. It lives in the cli/ directory and is published as the @aomkoyo/discord-cli package.
Claude Code runs inside a tmux session. Its system prompt instructs it to use discord-send for all replies. The CLI hits the Discord REST API v10 directly using Node.js built-in fetch — no Discord.js or other dependencies.
discord-send "Hello from Claude!"
discord-send "Reply to this" -r 1234567890123456789
discord-send "Here's a file" -f ./output.png
discord-send "Multiple files" -f ./a.png -f ./b.txt
discord-send "Remote file" -f https://example.com/image.png| Flag | Description |
|---|---|
-c <channelId> |
Target channel ID (defaults to DEFAULT_CHANNEL_ID) |
-r <messageId> |
Reply to a specific message |
-f <path or URL> |
Attach a file (can be repeated for multiple files) |
-t <token> |
Discord bot token (overrides env/.env) |
The CLI resolves credentials in this order:
-
-t <token>flag (highest priority) -
DISCORD_TOKENenvironment variable -
DISCORD_TOKENin.envfile (searches current directory, then parent directories)
-
-c <channelId>flag (highest priority) -
DEFAULT_CHANNEL_IDenvironment variable -
DEFAULT_CHANNEL_IDin.envfile
When a tmux session is created, the bot runs exportEnvToSession() which:
- Sets
DISCORD_TOKENandDEFAULT_CHANNEL_IDviatmux set-environment(for future child processes) - Types
export DISCORD_TOKEN=... DEFAULT_CHANNEL_ID=...as keystrokes into the shell (for the current session)
This ensures discord-send can find credentials regardless of Claude's working directory.
- Uses
allowed_mentions: { parse: [] }to prevent accidental @mentions - Text content is sent as-is — no markdown processing or escaping by the CLI
- File attachments are uploaded as multipart form data
- Remote URLs are fetched and re-uploaded (not linked)
Name: @aomkoyo/discord-cli
Version: 0.2.0
Binary: discord-send
Dependencies: none (zero runtime deps)
Node.js: 22+
claude-tmux-discord — Discord bot for per-channel Claude Code sessions via tmux
Setup
Usage
Technical
Help