This guide covers setting up the Discord client for tg-claude.
The Discord client uses a channel-based mono-repo model:
- Each Discord channel maps to its own workspace folder
- One channel = one repository (no multi-repo switching like Telegram)
- Plain text messages in channels execute as Claude tasks
- A Discord account
- A Discord server where you have admin permissions
- Go to the Discord Developer Portal
- Click New Application
- Give it a name (e.g., "Claude Code Bot")
- Click Create
- In your application, go to the Bot section
- Click Add Bot
- Under Privileged Gateway Intents, enable:
- Message Content Intent (required to read message content)
- Click Reset Token to get your bot token
- Copy the token - you'll need it for
DISCORD_BOT_TOKEN
Important: Never share your bot token publicly!
- Go to OAuth2 → General
- Copy the Client ID - you'll need it for
DISCORD_CLIENT_ID
- Go to OAuth2 → URL Generator
- Select scopes:
botapplications.commands
- Select bot permissions:
- Send Messages
- Embed Links
- Read Message History
- Use Slash Commands
- Copy the generated URL and open it in your browser
- Select your server and authorize
Add these to your .env file:
# Discord Configuration (required)
DISCORD_BOT_TOKEN=your_bot_token_here
DISCORD_CLIENT_ID=your_client_id_here
# Optional: For faster command registration during development
# DISCORD_GUILD_ID=your_server_id_here
# Optional: Restrict to specific users (if not set, all users allowed)
# DISCORD_ALLOWED_USER_IDS=123456789012345678,987654321098765432- Right-click your server name in Discord
- Select Copy Server ID
- Use this for
DISCORD_GUILD_ID
bun run startYou should see:
📱 Telegram: enabled
💬 Discord: enabled
| Command | Description |
|---|---|
/help |
Show available commands |
/status |
Show active tasks in this channel |
/cancel <task_id> |
Cancel a running task |
/version |
Show bot version |
Simply send a plain text message in any channel where the bot is present. The message will be executed as a Claude task in that channel's workspace folder.
Example:
Create a Python script that prints "Hello, World!"
Each Discord channel has its own isolated workspace:
/workspace/discord_{channel-name}_{channel-id-suffix}/
For example, a channel named #my-project might have workspace:
/workspace/discord_my_project_abc123/
By default, all users in channels where the bot is present can use it. To restrict to specific users:
DISCORD_ALLOWED_USER_IDS=123456789012345678,987654321098765432To get a Discord user ID:
- Enable Developer Mode in Discord settings (Settings → Advanced)
- Right-click the username → Copy User ID
- Check that Message Content Intent is enabled in the Developer Portal
- If using
DISCORD_ALLOWED_USER_IDS, verify the user ID is in the list - Check the bot has permissions to read/send messages in the channel
- If using
DISCORD_GUILD_ID, commands appear instantly - Without it, global commands can take up to 1 hour to propagate
- Try kicking and re-inviting the bot
The bot may be taking too long to respond. Discord requires responses within 3 seconds. Check your Claude execution performance.
- By default all users can execute commands (set
DISCORD_ALLOWED_USER_IDSto restrict) - Each channel is rate-limited independently
- The bot uses
--dangerously-skip-permissions- be careful who has access