Skip to content

Discord Setup

Run Clawdbot as a Discord bot to bring Claude’s intelligence to your servers. Perfect for communities, development teams, or personal use.

  • Clawdbot installed
  • Discord account
  • Server where you have “Manage Server” permission
  1. Create a Discord Application

    • Go to Discord Developer Portal
    • Click “New Application”
    • Name it (e.g., “Clawdbot”)
    • Navigate to “Bot” section
    • Click “Add Bot”
  2. Get the Bot Token

    • In Bot section, click “Reset Token”
    • Copy and save the token securely
  3. Enable Required Intents

    In Bot section, enable:

    • ✅ Message Content Intent
    • ✅ Server Members Intent (optional)
    • ✅ Presence Intent (optional)
  4. Generate Invite Link

    • Go to OAuth2 → URL Generator
    • Scopes: bot, applications.commands
    • Permissions: Send Messages, Read Message History, Embed Links, Attach Files
    • Copy the generated URL
  5. Add Bot to Server

    • Open the invite URL
    • Select your server
    • Authorize
  6. Configure Clawdbot

    Edit .env:

    Terminal window
    DISCORD_ENABLED=true
    DISCORD_BOT_TOKEN=your_token_here
  7. Start Clawdbot

    Terminal window
    python -m clawdbot
.env
# Required
DISCORD_BOT_TOKEN=your_token_here
DISCORD_ENABLED=true
# Rate limiting per user per channel
DISCORD_RATE_LIMIT=15
# Prefix for commands (if not using slash commands)
DISCORD_PREFIX=!
# Use slash commands
DISCORD_SLASH_COMMANDS=true
# Respond to DMs
DISCORD_DM_ENABLED=true
# Respond in all channels or only specific ones
DISCORD_ALLOWED_CHANNELS=123456789,987654321
# Require mention to respond
DISCORD_MENTION_ONLY=false
# Admin user IDs
DISCORD_ADMIN_USERS=123456789

Modern Discord bots use slash commands:

CommandDescription
/chat [message]Chat with Clawdbot
/resetClear your conversation history
/helpShow available commands
/settingsUser preferences

Traditional prefix-based commands:

!ask What's the meaning of life?
!reset
!help

Public Channel: Everyone sees the conversation

DISCORD_MENTION_ONLY=true # Only respond when @mentioned

Thread Support: Auto-create threads for conversations

DISCORD_USE_THREADS=true

DM Mode: Private conversations via direct message

DISCORD_DM_ENABLED=true
Media TypeReceiveSend
Text
Images
Files
Embeds-
Voice

Clawdbot formats responses with Discord embeds:

# Example embed format
{
"title": "Response",
"description": "Claude's answer here...",
"color": 0x5865F2,
"footer": {"text": "Powered by Claude"}
}

Clawdbot works across all servers it’s invited to. Configure per-server settings:

Terminal window
# Whitelist specific servers
DISCORD_ALLOWED_GUILDS=123456789,987654321
# Or blacklist
DISCORD_BLOCKED_GUILDS=111111111

Restrict bot usage to specific roles:

Terminal window
DISCORD_REQUIRED_ROLE=Clawdbot User
# Or by role ID
DISCORD_REQUIRED_ROLE_ID=123456789

Set the bot’s status message:

Terminal window
DISCORD_STATUS=Chatting with Claude
DISCORD_STATUS_TYPE=playing # playing, watching, listening, competing

Log all interactions for moderation:

Terminal window
DISCORD_LOG_CHANNEL=123456789 # Channel ID for logs
DISCORD_LOG_LEVEL=all # all, commands, errors
  1. Verify token is correct
  2. Check Clawdbot logs:
    Terminal window
    LOG_LEVEL=DEBUG python -m clawdbot
  3. Ensure intents are enabled in Developer Portal
  4. Restart Clawdbot

Bot lacks permissions. Re-invite with correct permissions:

  • Send Messages
  • Read Message History
  • Embed Links
  • Attach Files
  • Use Slash Commands
  1. Check Message Content Intent is enabled
  2. If using DISCORD_MENTION_ONLY=true, ensure you’re mentioning the bot
  3. Verify channel is in DISCORD_ALLOWED_CHANNELS (if set)
  4. Check rate limits
  1. Slash commands take up to 1 hour to register globally
  2. For instant updates, use guild-specific commands:
    Terminal window
    DISCORD_SLASH_COMMANDS_GUILD=123456789
  3. Re-invite bot with applications.commands scope
  • Check Clawdbot server location vs Discord servers
  • Reduce response length
  • Consider sharding for large deployments
  1. Never share your bot token
  2. Use DISCORD_ALLOWED_GUILDS to prevent unauthorized server additions
  3. Implement role-based access for public servers
  4. Monitor logs for abuse
  5. Rate limit to prevent spam
User: Hi! Can you help me with Python?
Clawdbot: Hello! I'd be happy to help with Python.
What would you like to know?
User: How do I read a JSON file?
Clawdbot: Here's how to read a JSON file in Python:
```python
import json
with open('data.json', 'r') as f:
data = json.load(f)
### Server Channel

@User: @Clawdbot what’s the best sorting algorithm? @Clawdbot: The “best” sorting algorithm depends on your use case: • Quick sort: O(n log n) average, great general purpose • Merge sort: O(n log n) guaranteed, stable • Radix sort: O(nk) for integers …

### Slash Command

/chat message:Explain recursion in one sentence Clawdbot: Recursion is when a function calls itself to solve a problem by breaking it into smaller instances of the same problem.

## Next Steps
- Add more channels: [Telegram](/channels/telegram/), [Slack](/channels/slack/)
- Learn about [plugins](/concepts/plugins/) for custom commands
- Set up [webhooks](/gateway/configuration/) for integrations