Discord Setup
Add your ClawBook AI assistant to Discord servers as a bot. It can respond in channels, DMs, and threads.
Prerequisites
- Active ClawBook subscription
- LLM provider configured
- Discord account
- Manage Server permission on target server
Creating a Discord Bot
Step 1: Create Application
- Go to Discord Developer Portal
- Click New Application
- Enter name:
ClawBook Assistant - Accept terms and click Create
Step 2: Configure Bot
- Go to Bot section (left sidebar)
- Click Add Bot → Yes, do it!
- Under Token, click Reset Token
- Copy and save the token securely
Step 3: Set Permissions
Under Bot section:
Privileged Gateway Intents:
☑ Presence Intent
☑ Server Members Intent
☑ Message Content Intent (Required!)
warning
Message Content Intent must be enabled or your bot won't see message content!
Step 4: Generate Invite Link
- Go to OAuth2 → URL Generator
- Select scopes:
- ☑
bot - ☑
applications.commands
- ☑
- Select permissions:
- ☑ Send Messages
- ☑ Send Messages in Threads
- ☑ Read Message History
- ☑ Add Reactions
- ☑ Use Slash Commands
- Copy the generated URL
Step 5: Add Bot to Server
- Open the generated URL in browser
- Select your server
- Click Authorize
- Complete CAPTCHA
Step 6: Connect to ClawBook
- Go to Integrations → Discord
- Enter your bot token
- Click Connect
Bot Token: MTIzNDU2Nzg5MDEyMzQ1Njc4.Xxxxxd.xxxxxxxxxxxxxxxxxxxxxxxxx
Application ID: 1234567890123456789
Bot Configuration
Trigger Modes
| Mode | Behavior | Example |
|---|---|---|
| Mention | Respond when @mentioned | @ClawBot hello |
| Prefix | Respond to commands | !ai hello or /ask hello |
| Always On | Respond to all messages in allowed channels | Any message |
| Slash Commands | Use Discord's built-in commands | /ask question |
Channel Settings
Allowed Channels:
- #ai-chat
- #general
- #help
Ignored Channels:
- #announcements
- #rules
Respond in Threads: Yes
Respond in DMs: Yes
Slash Commands
Register slash commands for a polished experience:
| Command | Description |
|---|---|
/ask [question] | Ask the AI a question |
/chat | Start a conversation thread |
/clear | Clear conversation history |
/help | Show available commands |
/settings | View your settings |
Setup in ClawBook:
- Integrations → Discord → Slash Commands
- Click Register Commands
- Wait up to 1 hour for global registration
Message Settings
Max Response Length: 2000 # Discord limit
Split Long Messages: Yes
Use Embeds: Yes
Embed Color: #8b5cf6
Show Typing Indicator: Yes
React with ✅ on Complete: No
Embed Format
Rich embeds look professional:
Embed Settings:
Title: Response
Color: #8b5cf6 (purple)
Footer: Powered by ClawBook
Timestamp: Yes
Author Icon: Bot avatar
Thread Integration
Create organized conversations:
Thread Settings:
Auto-create threads: No
Thread name format: "Chat with {user}"
Archive after: 24 hours
Keep context in thread: Yes
Permission Settings
Role-Based Access
Allowed Roles:
- @Members
- @VIP
- @Staff
Admin Roles:
- @Admin
- @Moderator
Blocked Roles:
- @Muted
Per-User Settings
Allowed Users:
- 123456789012345678 # User IDs
Blocked Users:
- 987654321098765432
Rate Limiting
Per-User:
Messages per minute: 5
Messages per hour: 50
Per-Channel:
Messages per minute: 20
Cooldown Message: "Please wait {seconds}s before asking again."
Advanced Features
Context Memory
Context Settings:
Max messages: 20
Time window: 1 hour
Per-channel context: Yes
Per-thread context: Yes
Shared server context: No
Multi-Server Support
Your bot can be in multiple servers:
Server 1 (ID: 1234567890):
Channels: #ai-chat
Model: Claude 3.5 Sonnet
Prefix: !ai
Server 2 (ID: 0987654321):
Channels: #bot-commands
Model: GPT-4o
Prefix: /ask
Reactions & Feedback
Enable users to rate responses:
Feedback Reactions:
👍 - Good response (logged)
👎 - Bad response (logged, triggers review)
🔄 - Regenerate response
❌ - Delete response
Webhooks for Notifications
Send proactive messages:
Webhook URL: https://discord.com/api/webhooks/xxx/xxx
Use for:
- System alerts
- Scheduled messages
- External triggers
Bot Customization
Rich Presence
Show bot status:
Activity Type: Watching
Activity Name: for /help commands
Status: Online
Options:
- Playing [game]
- Watching [thing]
- Listening to [music]
- Competing in [event]
Custom Avatar & Name
- Discord Developer Portal → Your Application
- Bot section
- Upload icon (1024x1024 recommended)
- Set username (limited changes)
Troubleshooting
Bot Offline
- Check token is valid:
tail -f /var/log/openclaw/discord.log - Verify intents are enabled
- Check ClawBook service is running
"Missing Permissions"
- Ensure bot role is above target channels
- Check channel-specific permissions
- Verify bot has required permissions
"Missing Message Content Intent"
- Go to Discord Developer Portal
- Bot → Enable Message Content Intent
- Restart ClawBook Discord integration
Bot Not Responding
- Check if bot is in the channel
- Verify trigger mode (mention vs prefix)
- Check rate limits aren't exceeded
- Verify LLM provider is working
Slash Commands Not Showing
- Commands take up to 1 hour to register globally
- Try server-specific registration (instant)
- Clear Discord cache: Ctrl+R
Rate Limited by Discord
Discord API limits:
- 50 requests/second global
- 5 messages/5 seconds per channel
ClawBook handles this automatically with queuing.
Security
Token Security
- Never commit token to code
- Regenerate if compromised
- Use environment variables
Permission Best Practices
- Use minimum required permissions
- Audit permissions regularly
- Use channel restrictions
Audit Logging
All bot actions are logged:
[2026-01-30 10:30:15] User#1234 in #general: "What's the weather?"
[2026-01-30 10:30:17] Bot response sent (247 tokens)
[2026-01-30 10:30:18] User reaction: 👍
Next Steps
- Advanced Settings - Fine-tune your bot
- Security Best Practices - Secure your setup
- Troubleshooting - Get help