Connect OpenClaw to Discord: Bot Setup Guide
Connect OpenClaw to Discord. Create a bot, set up intents, and start chatting in your server.
Overview
Discord is a popular choice for running OpenClaw in servers or communities. This guide walks you through creating a Discord bot, configuring it, and connecting it to OpenClaw.
- A Discord account
- Permission to manage bots in a Discord server (Server Admin)
- OpenClaw installed (see Getting Started)
Create Discord App & Bot
First, we need to create an application and bot in the Discord Developer Portal.
Create new application
Click New Application (top right). Give it a name (e.g., "OpenClaw Assistant").
Add a bot
Click Bot in the left sidebar, then Add Bot.
Copy the token
Click Reset Token to reveal your bot token, then copy it.
Enable Privileged Intents
Discord requires you to enable certain "intents" for the bot to access specific data.
Go to Bot settings
In the Developer Portal, go to Bot → scroll down to Privileged Gateway Intents.
Enable Message Content Intent
Toggle Message Content Intent to ON. This is required for the bot to read messages.
Enable Server Members Intent
Toggle Server Members Intent to ON. This helps with user allowlists and role-based routing.
Invite Bot to Server
Now let's generate an invite link to add the bot to your server.
Go to OAuth2
In the Developer Portal, go to OAuth2 → URL Generator.
Select scopes
Check the following scopes:
botapplications.commands
Select permissions
Under Bot Permissions, select:
- View Channels
- Send Messages
- Read Message History
- Embed Links
- Attach Files
- Add Reactions (optional)
Copy and visit URL
Copy the generated URL at the bottom and open it in your browser. Select your server and authorize.
Configure OpenClaw
Now let's tell OpenClaw about your Discord bot.
Open your config.yaml and add:
channels:
discord:
enabled: true
token: "YOUR_BOT_TOKEN"Start the Gateway
Start OpenClaw and let it connect to Discord:
openclaw gatewayYou should see logs indicating Discord is connecting. Once connected, it's time to authorize yourself.
Pair Your Account
By default, Discord DMs require pairing (authorization). Here's how to approve yourself:
Find your pairing code
Run this command in your terminal:
openclaw pairing list discordYou'll see a code like ABC123.
DM the bot
Go to your bot in Discord and send it a direct message with the code:
ABC123Approve the pairing
Back in your terminal:
openclaw pairing approve discord ABC123Test It
Now let's verify everything works:
Mention the bot
In your Discord server, mention your bot (e.g., @YourBot) or send it a direct message.
Wait for a response
Your AI assistant should respond. If it doesn't, check the troubleshooting section below.
Troubleshooting
Common issues and how to fix them:
Bot doesn't respond to messages
- Make sure you've enabled Message Content Intent in Developer Portal
- Check that Discord is enabled:
openclaw channels status - Check logs:
openclaw logs --follow
Bot can't see messages in channels
- Verify the bot has been invited with the correct permissions
- Make sure the bot is online (green status in Discord)
- Check that your server allows the bot in that channel
Finding your Discord user ID
Some configs require your numeric user ID. Enable Developer Mode in Discord (Settings → Advanced → Developer Mode), then right-click your name and "Copy User ID".