Skip to main content

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​

  1. Go to Discord Developer Portal
  2. Click New Application
  3. Enter name: ClawBook Assistant
  4. Accept terms and click Create

Step 2: Configure Bot​

  1. Go to Bot section (left sidebar)
  2. Click Add Bot → Yes, do it!
  3. Under Token, click Reset Token
  4. 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!

  1. Go to OAuth2 → URL Generator
  2. Select scopes:
    • ☑ bot
    • ☑ applications.commands
  3. Select permissions:
    • ☑ Send Messages
    • ☑ Send Messages in Threads
    • ☑ Read Message History
    • ☑ Add Reactions
    • ☑ Use Slash Commands
  4. Copy the generated URL

Step 5: Add Bot to Server​

  1. Open the generated URL in browser
  2. Select your server
  3. Click Authorize
  4. Complete CAPTCHA

Step 6: Connect to ClawBook​

  1. Go to Integrations → Discord
  2. Enter your bot token
  3. Click Connect
Bot Token: MTIzNDU2Nzg5MDEyMzQ1Njc4.Xxxxxd.xxxxxxxxxxxxxxxxxxxxxxxxx
Application ID: 1234567890123456789

Bot Configuration​

Trigger Modes​

ModeBehaviorExample
MentionRespond when @mentioned@ClawBot hello
PrefixRespond to commands!ai hello or /ask hello
Always OnRespond to all messages in allowed channelsAny message
Slash CommandsUse 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:

CommandDescription
/ask [question]Ask the AI a question
/chatStart a conversation thread
/clearClear conversation history
/helpShow available commands
/settingsView your settings

Setup in ClawBook:

  1. Integrations → Discord → Slash Commands
  2. Click Register Commands
  3. 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​

  1. Discord Developer Portal → Your Application
  2. Bot section
  3. Upload icon (1024x1024 recommended)
  4. Set username (limited changes)

Troubleshooting​

Bot Offline​

  1. Check token is valid:
    tail -f /var/log/openclaw/discord.log
  2. Verify intents are enabled
  3. 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"​

  1. Go to Discord Developer Portal
  2. Bot → Enable Message Content Intent
  3. Restart ClawBook Discord integration

Bot Not Responding​

  1. Check if bot is in the channel
  2. Verify trigger mode (mention vs prefix)
  3. Check rate limits aren't exceeded
  4. 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​