Discord
Connect your OpenClaw agent to Discord so it can respond to messages in your server. You will need to create a Discord application, set up a bot, and invite it to your server.
Prerequisites
- A Discord account
- A Discord server where you have permission to add bots
- Access to your OpenClaw Dashboard
Step-by-Step Setup
1. Create a Discord Application
- Go to the Discord Developer Portal.
- Click New Application in the top right.
- Give it a name (e.g., "My AI Agent") and click Create.
2. Get the Bot Token
- In the left sidebar, click Bot.
- Click Reset Token.
- Confirm the reset when prompted.
- Copy the token immediately -- it will only be shown once.
The bot token is displayed only once after you reset it. If you lose it, you will need to reset the token again, which invalidates the old one.
3. Enable Privileged Intents
Still on the Bot page, scroll down to Privileged Gateway Intents and enable:
- Message Content Intent -- allows the bot to read message content
- Server Members Intent -- allows the bot to see server member information
Click Save Changes.
Discord requires bots to explicitly request access to message content and member data. Without these intents enabled, your bot will receive empty messages and cannot function properly.
4. Generate an Invite Link
- In the left sidebar, click OAuth2.
- Click URL Generator.
- Under Scopes, check bot.
- Under Bot Permissions, check:
- Send Messages
- Read Message History
- Copy the Generated URL at the bottom of the page.
5. Add the Bot to Your Server
- Open the generated URL in your browser.
- Select the server you want to add the bot to.
- Click Authorize.
- Complete the CAPTCHA if prompted.
The bot should now appear in your server's member list (it will show as offline until OpenClaw connects).
6. Connect in OpenClaw
- Go to your OpenClaw Dashboard.
- Navigate to Instance > Channels.
- Click Discord.
- Click Connect.
- Paste the bot token you copied in step 2.
- Click Save.
OpenClaw will connect to Discord using your token. The bot should appear as online in your server within a few seconds.
7. Test It
Send a message in a channel where the bot has access, or send the bot a direct message. Your OpenClaw agent should respond.
Troubleshooting
- Bot is offline in the server: Check that the channel shows as "Connected" in your OpenClaw dashboard. Verify you pasted the correct, most recent token.
- Bot does not respond to messages: Make sure you enabled the Message Content Intent in step 3. Without it, the bot receives empty messages.
- "Invalid token" error: You may have copied the token incorrectly, or it may have been reset since you copied it. Go to the Developer Portal, reset the token, and try again.
- Bot cannot see certain channels: Check the channel permissions in Discord. The bot needs "View Channel" and "Send Messages" permissions for each channel it should access.