Quick Start
The fastest way to set up Discord is with the interactive onboarding:Creating a Discord Bot
Create an application
- Go to the Discord Developer Portal
- Click “New Application”
- Give your application a name (e.g., “OpenClaw Bot”)
- Click “Create”
Create a bot user
- In the left sidebar, click “Bot”
- Click “Add Bot” → “Yes, do it!”
- Under “Token”, click “Reset Token” and copy the token
- Save this token securely - you’ll need it for configuration
Enable required intents
Discord bots need specific “intents” (permissions to receive events). Enable these under the “Bot” tab:
- Message Content Intent - Required to read message text
- Server Members Intent - Optional, for member-related events
- Presence Intent - Optional, for user status updates
Generate invite URL
- Go to “OAuth2” → “URL Generator”
- Under “Scopes”, select:
botapplications.commands(if you want slash commands)
- Under “Bot Permissions”, select:
Read Messages/View ChannelsSend MessagesEmbed LinksAttach FilesRead Message HistoryAdd ReactionsUse Slash Commands(optional)
- Copy the generated URL at the bottom
Configuration
Using Environment Variables
The simplest way to configure Discord:Using Config File
Alternatively, store the token directly inopenclaw.config.json:
| Key | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable Discord channel |
token | string | - | Bot token from Discord Developer Portal (or use DISCORD_BOT_TOKEN env var) |
dmPolicy | string | "pairing" | DM access policy: pairing, allowlist, open, disabled |
allowFrom | string[] | [] | Discord user IDs allowed to DM (e.g., ["123456789012345678"]) |
groupPolicy | string | "allowlist" | Channel access policy: allowlist, open, disabled |
guilds | object | {} | Per-guild and per-channel configuration |
DM Policies
pairing(recommended): Unknown users get a pairing code; approve withopenclaw pairing approve discord <userId>allowlist: Only user IDs inallowFromcan DM the botopen: Anyone can DM the bot (setallowFrom: ["*"])disabled: Ignore all Discord DMs
Getting Your Discord User ID
Alternatively, DM your bot and check the logs:
Guild and Channel Configuration
Allowlist Specific Channels
To restrict the bot to specific guilds and channels:- Enable Developer Mode in Discord
- Right-click the server icon → “Copy Server ID” (guild ID)
- Right-click a channel → “Copy Channel ID”
Allowlist Entire Guild
To allow all channels in a guild:Per-Channel Settings
| Key | Type | Default | Description |
|---|---|---|---|
allow | boolean | false | Enable bot in this channel |
requireMention | boolean | false | Only respond when bot is @mentioned |
allowFrom | string[] | [] | User IDs allowed to use the bot in this channel |
toolPolicy | string | "open" | Tool usage policy: open, allowlist, disabled |
Resolving Channel Names
OpenClaw can resolve channel names to IDs:Thread Support
Discord threads are automatically detected and maintained. Messages in a thread will keep conversation context:Mention Handling
By default, the bot responds to:- Direct @mentions:
@BotName hello - Replies to bot messages
- DMs (subject to
dmPolicy)
requireMention: true in the channel config.
Rich Embeds
Discord supports rich embeds (formatted messages with colors, images, fields). OpenClaw automatically renders supported content as embeds.Reactions
Discord supports emoji reactions. The bot can:- React to messages
- Receive reaction events
- Use custom server emojis (if available)
Multi-Account Support
You can run multiple Discord bots:Troubleshooting
Bot not responding to messages
Bot not responding to messages
Check these common issues:
-
Message Content Intent is disabled
- Go to Discord Developer Portal → Bot → Enable “Message Content Intent”
-
Bot lacks permissions in the channel
- Ensure bot role has “Read Messages” and “Send Messages” permissions
-
Channel not in allowlist
- Check
guildsconfiguration includes the channel ID
- Check
-
User not in allowFrom
- Add your user ID to
allowFromor usedmPolicy: "pairing"
- Add your user ID to
Websocket connection errors
Websocket connection errors
Discord uses WebSocket Gateway for real-time events. Connection errors usually mean:
- Invalid bot token
- Network/firewall blocking WebSocket connections
- Discord API outage (check Discord Status)
Bot can't see message content
Bot can't see message content
This is almost always due to Message Content Intent being disabled.
- Go to Discord Developer Portal
- Select your application
- Go to “Bot” tab
- Scroll to “Privileged Gateway Intents”
- Enable “Message Content Intent”
- Save changes
- Restart OpenClaw
Invalid token error
Invalid token error
Double-check your bot token. It should be a long alphanumeric string.If you suspect the token is compromised:
- Go to Discord Developer Portal → Bot
- Click “Reset Token”
- Update your config with the new token
Bot immediately leaves voice channels
Bot immediately leaves voice channels
Voice channel support requires additional dependencies and configuration. See the voice channels documentation for setup.
Security Considerations
- Keep your bot token secret - it gives full control of your bot
- Use environment variables instead of committing tokens to version control
- Rotate tokens if they may have been exposed
- Use allowlist mode for production bots
- Limit bot permissions to only what’s needed
- Monitor bot activity via logs and Discord’s audit log
Advanced Configuration
Proxy Support
If you need to route Discord traffic through a proxy:Rate Limiting
Discord enforces rate limits. OpenClaw automatically handles rate limiting, but you can configure retry behavior:Next Steps
Slack Setup
Set up Slack as another channel
Pairing Guide
Learn about pairing codes and approvals
Configuration Reference
Full configuration options
Multi-Channel
Using multiple channels together

