๐ฎ Discord Bot Setup
Add your OpenClaw to Discord servers
Discord vs Telegram
Discord setup is slightly more involved than Telegram, but gives you more features like slash commands, reactions, and server integrations. Great if you live in Discord or want to add OpenClaw to a community server.
Create a Discord Application
- Go to the Discord Developer Portal
- Click "New Application"
- Name it (e.g., "My OpenClaw") and click Create
- You're now in your application's settings
Create a Bot User
- In the left sidebar, click "Bot"
- Click "Add Bot" โ "Yes, do it!"
- Under the bot's username, click "Reset Token"
- Copy the token โ you'll need this for OpenClaw
โ ๏ธ Keep Your Token Secret
Never share your bot token. Anyone with it can control your bot. If it leaks, immediately reset it in the Developer Portal.
Configure Bot Settings
On the Bot page, configure these settings:
- Public Bot: Disable if you only want to add it to your own servers
- Message Content Intent: ENABLE THIS โ required to read messages
- Server Members Intent: Enable if you need member info
- Presence Intent: Optional, for user status
โ ๏ธ Message Content Intent Required
Without "Message Content Intent" enabled, your bot cannot read message text. This is the most common setup mistake!
Generate an Invite Link
- Go to "OAuth2" โ "URL Generator"
- Under Scopes, select:
botandapplications.commands - Under Bot Permissions, select the permissions below
- Copy the generated URL at the bottom
Recommended Permissions
Invite the Bot to Your Server
- Open the invite URL you generated
- Select the server you want to add it to
- Authorize the requested permissions
- Complete any CAPTCHA if prompted
Your bot should now appear offline in your server's member list.
Get Your Discord User ID
To restrict who can use the bot:
- Enable Developer Mode: User Settings โ App Settings โ Advanced โ Developer Mode
- Right-click your username anywhere in Discord
- Click "Copy User ID"
# Your ID will look like: 123456789012345678
Configure OpenClaw
# Add to ~/.openclaw/config.yaml: channels: discord: token: "YOUR_BOT_TOKEN" allowedUsers: - "123456789012345678" # Your Discord user ID
Or via CLI:
openclaw channels add discord \ --token "YOUR_BOT_TOKEN" \ --allowed-users "123456789012345678"
Start OpenClaw
openclaw gateway
# Your bot should come online in Discord!
๐ Done!
Your bot is now online. DM it or mention it in a channel to start chatting!
Interaction Modes
DM Mode (Default)
By default, the bot responds to direct messages from allowed users. Just DM it like you would a friend.
Channel Mode (Mentions)
In server channels, the bot responds when @mentioned:
@MyOpenClaw what's the weather like today?
Prefix Mode
Configure a command prefix so the bot responds to messages starting with it:
channels:
discord:
token: "..."
prefix: "!" # Bot responds to !command
# Usage:
!what's the weather today?
Troubleshooting
Bot doesn't respond?
- Check Message Content Intent is enabled in Developer Portal
- Verify your user ID is in the allowedUsers list
- Check OpenClaw logs:
openclaw logs -f - Make sure the bot has permissions in the channel
Bot is offline?
- Check OpenClaw is running:
openclaw status - Verify token is correct (reset in Developer Portal if unsure)
- Check for errors:
openclaw logs
"Privileged Intents" error?
You need to enable the Message Content Intent in the Discord Developer Portal under Bot settings. This is required for bots in 100+ servers, but good practice to enable for all bots.
Related Guides
- Security Checklist โ Secure your installation
- Telegram Setup โ Alternative: easier setup
- Raspberry Pi Setup โ 24/7 hosting