Discord is one of the most popular platforms for communities, and OpenClaw makes it incredibly easy to add AI capabilities to your server. This guide walks you through creating an AI-powered Discord bot.
Prerequisites
Before starting, ensure you have:
- OpenClaw installed and configured
- A Discord account
- Permissions to create bots in your server
- Your chosen LLM API key (Anthropic Claude or OpenAI)
Step 1: Create a Discord Application
- Go to the Discord Developer Portal
- Click "New Application"
- Give your bot a name (e.g., "OpenClaw Assistant")
- Click "Create"
Step 2: Create the Bot User
In your application settings:
- Navigate to the "Bot" section
- Click "Add Bot"
- Confirm by clicking "Yes, do it!"
- Copy your bot token (you'll need this for OpenClaw)
Step 3: Configure Bot Permissions
In the Bot section, enable these privileged intents:
- MESSAGE CONTENT INTENT - Required to read messages
- SERVER MEMBERS INTENT - For user information (optional)
Also enable:
- Presence Intent (if you want status updates)
- Public bot (if you want others to invite it)
Step 4: Configure OpenClaw
Edit your OpenClaw configuration:
# ~/.config/openclaw/config.yaml
integrations:
discord:
enabled: true
botToken: "YOUR_BOT_TOKEN_HERE"
clientId: "YOUR_CLIENT_ID"
Step 5: Generate Invite Link
Use OpenClaw to generate an invite URL for your bot:
# Generate invite URL with default permissions
openclaw discord invite --permissions "2147483647"
Or manually construct the URL:
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=2147483647&scope=bot%20applications.commands
Step 6: Invite Bot to Server
- Open the invite URL in your browser
- Select your server from the dropdown
- Click "Authorize"
- Complete the CAPTCHA if prompted
Step 7: Start OpenClaw
# Start the daemon
openclaw daemon start
# Verify Discord connection
openclaw integrations status discord
Step 8: Test Your Bot
In your Discord server:
- Type
/openclawto see available commands - Or mention your bot:
@OpenClawBot hello - The bot should respond with AI-generated text
Slash Commands
OpenClaw automatically registers these slash commands:
/ask- Ask the AI a question/chat- Start or continue a conversation/reset- Reset conversation context/help- Show available commands
Advanced Configuration
Custom Prefix
Change the command prefix for message-based commands:
# config.yaml
integrations:
discord:
commandPrefix: "!" # Use ! instead of default
Channel Filtering
Limit bot responses to specific channels:
# config.yaml
integrations:
discord:
allowedChannels:
- "ai-chat"
- "bot-commands"
blockedChannels:
- "general"
- "announcements"
Multi-Agent per Server
Route different servers to different agents:
# config.yaml
routing:
discord:
- match:
server: "My Server ID"
channel: "coding"
agent: "coding-assistant"
- match:
server: "My Server ID"
channel: "writing"
agent: "writer-assistant"
Rich Embeds
OpenClaw can send rich Discord embeds for better formatting:
# config.yaml
integrations:
discord:
embeds:
enabled: true
color: "#ff4757"
includeTimestamp: true
Troubleshooting
Bot Not Responding
- Check daemon is running:
openclaw daemon status - Verify bot token is correct
- Ensure MESSAGE CONTENT INTENT is enabled
- Check logs:
openclaw daemon logs
"Invalid Intent" Error
- Go to Discord Developer Portal
- Enable Privileged Gateway Intents
- Toggle MESSAGE CONTENT INTENT on
- Save changes and restart OpenClaw
Bot Can't Read Messages
- Verify bot has "Read Messages" permission in channel
- Check "View Channel" permission is enabled
- Ensure bot wasn't kicked from server
Use Cases
OpenClaw on Discord is perfect for:
- Moderation Assistance: Help review and flag content
- Community Support: Answer common questions automatically
- Knowledge Base: AI that knows your server's documentation
- Coding Help: Code review and assistance in dev servers
- Games & Fun: AI-powered games and trivia
What's Next?
References
- OpenClaw Official Documentation - https://docs.openclaw.ai/ - Accessed February 2026
- OpenClaw GitHub Repository - https://github.com/openclaw/openclaw - Accessed February 2026
- Discord Developer Portal - https://discord.com/developers/docs - Accessed February 2026
- Discord Bot Permissions Calculator - Permissions Reference - Accessed February 2026
Reference Trail
External sources surfaced from the underlying article content
- Discord Developer Portaldiscord.com
- https://docs.openclaw.ai/docs.openclaw.ai
- https://github.com/openclaw/openclawgithub.com
- https://discord.com/developers/docsdiscord.com
- Permissions Referencediscord.com