How to integrate OpenClaw with Discord?
Clawpedia · For Humans
Connect OpenClaw to your Discord server so your AI agent can respond to messages and commands in channels.
How to Integrate OpenClaw with Discord?
Discord is a natural home for AI agents — its bot framework is powerful, its community is tech-savvy, and OpenClaw integrates seamlessly. Whether for personal use or a community server, this guide walks you through the full setup.
---
Why Discord?
| Feature | Benefit |
|---|
| Free bot hosting | No API fees from Discord |
|---|
| Rich embeds | Formatted responses with colors and fields |
|---|
| Slash commands | Clean, discoverable bot interactions |
|---|
| Thread support | Organized conversations per topic |
|---|
| Voice channels | Potential for voice interaction |
|---|
| Multi-server | One bot across many servers |
|---|
---
Step 1: Create a Discord Application
- Go to Discord Developer Portal
- Click New Application → name it (e.g., "OpenClaw Agent")
- Go to Bot section → click Add Bot
- Copy the Bot Token
- Enable these Privileged Gateway Intents:
- ✅ Message Content Intent
- ✅ Server Members Intent (optional)
Important: Never share your bot token publicly.
---
Step 2: Invite the Bot to Your Server
Generate an invite URL:
- Go to OAuth2 → URL Generator
- Select scopes:
bot,applications.commands - Select permissions:
- Send Messages
- Read Messages/View Channels
- Embed Links
- Attach Files
- Read Message History
- Add Reactions
- Use Slash Commands
- Copy the URL and open it in your browser
- Select your server and authorize
---
Step 3: Connect to OpenClaw
openclaw connect discord --token YOUR_BOT_TOKEN
Or configure manually:
# ~/.openclaw/config.yaml
platforms:
discord:
enabled: true
token: "YOUR_BOT_TOKEN"
Start the gateway:
openclaw gateway start
---
Step 4: Test
- Open Discord
- Go to a channel where the bot has access
- Mention the bot:
@OpenClaw what can you do? - You should receive a response
---
Configuration
platforms:
discord:
enabled: true
token: "YOUR_BOT_TOKEN"
# Response behavior
response_mode: mention # mention, all, slash_only
typing_indicator: true # Show typing animation
use_embeds: true # Rich embed formatting
embed_color: "#00D4AA" # Embed accent color
split_long_messages: true # Auto-split at 2000 chars
reply_in_thread: false # Create threads for conversations
# Access control
allowed_channels: # Restrict to specific channels
- "123456789012345678"
allowed_roles: # Restrict to specific roles
- "Bot Users"
admin_users: # Users who can manage the bot
- "987654321098765432"
# Features
slash_commands: true # Register slash commands
image_analysis: true # Analyze uploaded images
file_processing: true # Process uploaded files
---
Response Modes
| Mode | Behavior | Best For |
|---|
mention | Only responds when @mentioned | Shared servers |
|---|
all | Responds to every message in allowed channels | Dedicated bot channel |
|---|
slash_only | Only responds to /commands | Clean interaction |
|---|
dm | Always responds in DMs | Personal use |
|---|
---
Slash Commands
OpenClaw automatically registers these slash commands:
| Command | Description |
|---|
/ask [question] | Ask the agent a question |
|---|
/chat | Start an interactive conversation |
|---|
/skill [name] | Run a specific skill |
|---|
/memory | View or manage memories |
|---|
/model [name] | Switch AI model |
|---|
/status | Check bot status |
|---|
/help | Show available commands |
|---|
Custom slash commands can be added via skills.
---
Rich Embed Responses
When use_embeds is enabled, responses are formatted as Discord embeds:
┌─────────────────────────────────────────┐
│ 🤖 OpenClaw │
├─────────────────────────────────────────┤
│ │
│ The Fibonacci sequence is defined as: │
│ │
│ F(n) = F(n-1) + F(n-2) │
│ │
│ First 10 terms: │
│ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 │
│ │
├─────────────────────────────────────────┤
│ Model: gpt-4o │ Latency: 1.2s │
└─────────────────────────────────────────┘
---
Thread Conversations
Enable threaded conversations for organized discussions:
platforms:
discord:
reply_in_thread: true
thread_name_from_first_message: true
thread_auto_archive: 60 # Minutes before auto-archive
This creates a new thread for each conversation, keeping channels clean.
---
Multi-Server Setup
One OpenClaw bot can serve multiple Discord servers:
platforms:
discord:
servers:
"Server A":
allowed_channels: ["bot-chat"]
model: gpt-4o-mini # Budget model for public server
"Server B":
allowed_channels: ["ai-lab"]
model: gpt-4o # Premium model for private server
---
Voice Channel Integration (Experimental)
OpenClaw can join voice channels for speech interaction:
openclaw connect discord --enable-voice
Requirements:
- FFmpeg installed on your system
- Speech-to-text model configured
- Additional bot permissions (Connect, Speak)
---
Security Best Practices
- Restrict channels: Don't let the bot respond everywhere
- Use role-based access: Only certain roles can interact
- Rate limit: Prevent spam
- Monitor logs: Review what users are asking
security:
rate_limit: 10 # Max messages per minute per user
max_input_length: 2000 # Prevent extremely long inputs
content_filter: true # Filter harmful requests
---
Troubleshooting
Bot Is Online but Not Responding
- Check Message Content Intent is enabled in Developer Portal
- Verify channel permissions
- Check response mode (mention vs. all)
- Review logs:
openclaw logs --filter discord
"Missing Permissions"
Re-invite with correct permissions using the OAuth2 URL generator.
Slash Commands Not Showing
# Re-register commands
openclaw discord sync-commands
Slash commands may take up to 1 hour to propagate globally.
Rate Limited by Discord
Discord limits bots to ~50 messages per second. If you hit limits:
platforms:
discord:
response_delay: 500 # Add delay between responses
---
Summary
Discord is an excellent platform for OpenClaw with its rich bot framework, slash commands, embeds, and thread support. Setup takes about 5 minutes: create a bot, invite it, and run openclaw connect discord. For communities, use role-based access and dedicated channels to keep things organized.
Related Articles
- How to integrate OpenClaw with Telegram? — Connect your OpenClaw agent to Telegram for private and group chat interactions using a Telegram bot token.
- Using OpenClaw with WhatsApp, Telegram, and Discord — Connect your OpenClaw agent to popular messaging platforms for seamless AI-powered conversations.
- How to use OpenClaw in group chats (e.g., Discord or Slack)? — Configure OpenClaw to participate in group conversations, respond to mentions, and manage multi-user interactions.
- How to connect OpenClaw to WhatsApp? — Link OpenClaw to WhatsApp so your AI agent can send and receive messages on the world's most popular messenger.
- Community Support: Forums and Q&A for OpenClaw — Find help and connect with other users through OpenClaw community forums, Discord, and Q&A channels.