A Discord bot that enables interaction with Claude Code through Discord channels. Each channel can be mapped to a different project, allowing you to manage multiple codebases through Discord.
- Multi-Project Support: Map different Discord channels to different project directories
- Session Management: Create, manage, and end Claude Code sessions per thread
- Mode Switching: Switch between Action, Plan, and Ask modes
- Permission Handling: Interactive permission prompts for tool executions
- Image Support: Send images for Claude to analyze
- Voice Messages: Text-to-speech responses and voice message transcription
- Subsession Delegation: Spawn parallel sub-agents for complex tasks
- Hot-Reload Configuration: Update settings without restarting the bot
- Node.js 20+
- Claude Code CLI authenticated
- Discord Bot with Manage Channels permission
Clone the repo and ask Claude Code to set it up:
git clone https://github.com/anthropics/claude-with-discord.git
cd claude-with-discord
claudeThen paste this prompt:
Set up this Discord bot for me:
1. Run ./scripts/setup.sh and follow the prompts
2. I'll provide the Discord bot token when asked
3. Help me configure my first project channel
- Setup Script - Run
./scripts/setup.shdirectly - Setup Guide - Step-by-step manual instructions
- Send a message in a configured channel
- A new thread will be created with your session
- Claude Code will respond in the thread
- New Session: Start a fresh session
- End Session: Close the current session
- Mode Switch: Toggle between Action/Plan/Ask modes
| Mode | Description |
|---|---|
| Action | Claude executes tasks directly |
| Plan | Claude creates plans for approval before execution |
| Ask | Claude only answers questions, no code changes |
The bot supports spawning parallel sub-agents for complex tasks:
- Sub-agents run in their own Discord threads
- Results are automatically delivered back to the parent session
- Useful for parallelizing independent tasks
See config.example.json for all available options.
Key settings:
| Option | Description |
|---|---|
channel_project_map |
Maps Discord channel IDs to project directories |
channel_system_prompts |
Custom system prompts per channel |
permission_mode |
"bypassPermissions" or "default" |
max_concurrent_sessions |
Maximum active sessions |
allowed_users |
Restrict access to specific Discord user IDs |
# Development mode with hot reload
npm run dev
# Build TypeScript
npm run build
# Lint and format
npm run lint
npm run formatsrc/
├── index.ts # Entry point
├── config.ts # Configuration management
├── types.ts # TypeScript types
├── discord/ # Discord.js integration
│ ├── client.ts # Discord client setup
│ ├── events/ # Event handlers
│ └── components/ # Interactive components
├── claude/ # Claude Agent SDK integration
│ ├── sessionManager.ts # Core session logic
│ └── messageFormatter.ts
├── mcp/ # Model Context Protocol
│ └── tools/ # MCP tools for subsessions
├── services/ # Business logic services
└── utils/ # Utilities
- Setup Guide - Detailed installation instructions
- Contributing - Contribution guidelines
- Security - Security policy
MIT License - see LICENSE for details.
- Built with Claude Agent SDK
- Powered by discord.js