A system of Discord bots powered by Claude AI. These bots work together to create a complete AI-powered Discord experience — from simple Q&A to remote code execution and bridging into Claude Code sessions. They use the Anthropic API and discord.py.
Each bot handles a different layer of the pipeline, and they combine to form a complete system:
Discord User
│
├── !ask / !private / DMs ──► Agent Bot ──► Claude API ──► Response in Discord
│
├── !read / !py / !cmd ─────► Power Bot ──► Local files, code execution
│ │
├── !bridge / DMs ──────────► Bridge Bot ──► bridge/incoming.txt
│ │
│ Claude Code (reads file)
│ │
│ bridge/outgoing.txt
│ │
│ Bot picks up ◄───────┘
│ response → Discord
│
├── CLI one-shot ───────────► Webhook Bot ──► Discord channel (via webhook)
│
└── Workflow automation ────► Custom Tool ──► Discord channel (via webhook)
- Agent Bot handles user-facing interaction — questions, private threads, access control
- Power Bot adds project-level tools — file access, code execution, conversation memory
- Bridge Bot / Power Bot bridge connects Discord to a running Claude Code session through file-based IPC
- Webhook Bot + Interactive Chat provide quick CLI-to-Discord posting for scripts and one-off questions
For the full experience, run the Power Bot alongside Claude Code — users chat in Discord, simple questions get answered via the API, and complex tasks get bridged to Claude Code for full IDE-level processing.
The main Discord bot. Runs as a persistent bot in your server.
Commands:
| Command | Description |
|---|---|
!ask <question> |
Ask Claude AI a question |
!private |
Create a private thread for conversation |
!calc <expression> |
Quick math calculations |
!request |
Request access to use the bot |
!help |
Show available commands |
!approve @user |
(Owner) Approve a user |
!unapprove @user |
(Owner) Remove user approval |
!pending |
(Owner) View pending access requests |
Full-featured bot with Claude AI, file access, code execution, conversation memory, and Claude Code bridging.
Additional commands:
| Command | Description |
|---|---|
!read <file> |
Read files from the project directory |
!ls [directory] |
List files |
!py <code> |
Execute Python code (10s timeout) |
!cmd <command> |
Run shell commands (limited to safe commands) |
!bridge <message> |
Send a message to Claude Code |
!clear |
Clear conversation memory |
Bridge System:
Messages sent via !bridge or DM are written to bridge/incoming.txt. Claude Code can read these and write responses to bridge/outgoing.txt, which the bot sends back to Discord.
Lightweight bot that only bridges Discord messages to Claude Code via files.
Discord User → bridge/incoming.txt → Claude Code
↓
Discord User ← bridge/outgoing.txt ← Claude Code
Background process that monitors bridge/incoming.txt and auto-responds using the Claude API. Pairs with the Bridge Bot for autonomous Discord responses.
One-shot script — ask Claude a question from the command line and post the answer to Discord via webhook.
Run: python discord_bot.py "What is quantum computing?"
CLI chat interface that also posts responses to Discord via webhook.
Run: python discord_chat.py
- Python 3.10+
pip install discord.py httpx anthropic
| Variable | Used by | Description |
|---|---|---|
DISCORD_BOT_TOKEN |
Agent Bot, Power Bot, Bridge Bot | Bot token from Discord Developer Portal |
ANTHROPIC_API_KEY |
All bots | API key from Anthropic Console |
DISCORD_WEBHOOK |
Webhook Bot, Interactive Chat | Webhook URL from Server Settings > Integrations > Webhooks |
export DISCORD_BOT_TOKEN="your-bot-token"
export ANTHROPIC_API_KEY="your-api-key"
export DISCORD_WEBHOOK="https://discord.com/api/webhooks/..."- Go to Discord Developer Portal
- Create a new application
- Go to Bot > create bot > copy token
- Enable Message Content Intent under Privileged Gateway Intents
- Go to OAuth2 > URL Generator > select
botscope > select permissions: Send Messages, Create Public Threads, Create Private Threads, Read Message History - Use the generated URL to invite the bot to your server
# Main bot (recommended starting point)
python claude_discord_bot.py
# Full-featured bot with file access, code exec, and memory
python claude_power_bot.py
# Bridge bot (pair with bridge_watcher.py)
python claude_bridge_bot.py
# Auto-responder for bridge
python bridge_watcher.pyThe bot restricts access by default. Only approved users can use commands:
- A new user types
!requestto request access - The bot owner sees pending requests with
!pending - The owner approves with
!approve @user - Approved users are saved to
approved_users.json(persists across restarts)
Claude-Discord-Bot/
├── claude_discord_bot.py # Main Claude AI bot
├── claude_power_bot.py # Full-featured bot (AI + files + code + memory)
├── claude_bridge_bot.py # File-based bridge bot
├── bridge_watcher.py # Auto-responder for bridge
├── discord_bot.py # Simple webhook bot
├── discord_chat.py # Interactive CLI chat
├── DISCORD_BOTS.md # Detailed documentation
├── bridge/
│ ├── incoming.txt # Messages from Discord
│ ├── outgoing.txt # Responses to Discord
│ ├── allowed_users.txt # User allowlist
│ └── pending_requests.json # Pending access requests
├── my_plugins/
│ ├── anthropic_provider/ # Anthropic API provider
│ ├── nat_anthropic/ # Anthropic LLM integration
│ └── custom_tools/ # Custom Discord/command tools
└── *.yaml # Workflow configs
- Full AI Pipeline — Power Bot + Claude Code for end-to-end: Discord chat → API answers + bridged code tasks → results back in Discord
- Personal AI Assistant — Agent Bot with
!privatethreads for topic-based conversations - Team Q&A — Agent Bot with approval system for controlled team access
- Remote Claude Code Control — Bridge Bot lets you control your desktop from Discord on your phone
- Automated Notifications — Webhook bot for scripts/workflows posting to Discord