- → Create a Discord application in the developer portal, generate a bot token, and enable Message Content and Server Members gateway intents before running any OpenClaw command
- → Run
openclaw channels add discordand supply your bot token — OpenClaw handles the WebSocket connection automatically - → Register slash commands via OpenClaw's built-in command registration so Discord's interface shows autocomplete for your agent
- → Use the permissions calculator in the developer portal to generate an invite URL with only the scopes your bot actually needs
- → A bot showing as offline almost always means an expired token or missing Message Content Intent — both are two-minute fixes
Discord communities running OpenClaw bots handle 400+ daily queries with zero human moderation overhead. The setup is not complex — but it has five specific steps that must happen in the right order. Skip one, and the bot connects but silently ignores every message.
Discord Developer Portal: Creating Your Application
Go to discord.com/developers/applications and click New Application. Name it whatever your community will recognize — this name appears in the bot's profile and in audit logs. The application ID shown on the General Information page is the value you'll need later for slash command registration.
Navigate to the Bot tab in the left sidebar. Click Add Bot and confirm. Discord creates the bot user tied to your application. This is also where you'll generate the token in the next step.
A Discord application can only have one bot user. If you want multiple bots with different personalities or capabilities in the same server, create multiple applications. Each gets its own token, its own invite URL, and its own permission set. OpenClaw supports multiple channel registrations, so you can run several Discord bots from one OpenClaw gateway.
Bot Token and Gateway Intents
On the Bot tab, click Reset Token to generate your bot token. Copy it immediately — Discord only shows it once. Store it in a secure location; this token is the full key to your bot.
Scroll down to the Privileged Gateway Intents section. Enable both:
- Server Members Intent — lets OpenClaw resolve usernames and member details
- Message Content Intent — lets OpenClaw read the actual text of messages in channels
Without Message Content Intent, your bot will connect to Discord, appear online, and receive zero useful events. This is the single most common setup error. Enable it before moving forward.
Never paste your bot token into source code, commit it to Git, or share it in Discord itself. If a token is exposed, reset it immediately in the developer portal — old tokens become invalid the moment you regenerate. Store tokens in environment variables or a secrets manager, and reference them by name in your OpenClaw config.
Adding the Discord Channel to OpenClaw
With your token ready, register the Discord channel in OpenClaw:
# Register the Discord channel
openclaw channels add discord
# OpenClaw will prompt for:
# → Bot Token: paste your token here
# → Application ID: from the General Information page
# → Command Prefix: "/" for slash commands, or "!" for prefix commands
# Verify the channel is registered
openclaw channels list
OpenClaw writes the channel configuration to your gateway config and starts the Discord WebSocket connection. Within 30 seconds, your bot should appear online in any server it has joined.
Sound familiar? This is the same channels add pattern used for every channel type in OpenClaw — Telegram, WhatsApp, Slack. The interface is consistent so you never have to learn a new setup flow per platform.
Slash Command Registration
Discord's slash command system requires commands to be registered with Discord's API before they appear in the interface. OpenClaw handles this registration automatically when you run:
# Register slash commands for your Discord bot
openclaw discord register-commands --channel-id discord-001
# Register globally (all servers, takes up to 1 hour to propagate)
openclaw discord register-commands --channel-id discord-001 --global
# Register to a specific server only (instant propagation, good for testing)
openclaw discord register-commands --channel-id discord-001 --guild-id YOUR_SERVER_ID
Guild-scoped commands update instantly — use them during development. Global commands take up to an hour to propagate across Discord's infrastructure. Ship guild-scoped for testing, switch to global for production.
Here's where most people stop. They register commands but forget to configure what each command does in their agent definition. Each slash command maps to a specific prompt template in OpenClaw. Define them in your agent config:
# agent.yaml — slash command mapping
commands:
- name: ask
description: "Ask the AI agent anything"
prompt_template: "User asked via Discord: {user_input}"
- name: summarize
description: "Summarize the last 20 messages in this channel"
prompt_template: "Summarize the recent conversation: {context}"
Permissions, Scopes, and the Invite URL
In the developer portal, navigate to OAuth2 → URL Generator. Select bot and applications.commands as scopes. Then select the permissions your bot needs:
| Permission | Why It's Needed | Required? |
|---|---|---|
| Send Messages | Bot can reply in channels | Yes |
| Read Message History | Bot can retrieve context from past messages | Yes |
| Use Slash Commands | Slash commands appear in the interface | Yes |
| Embed Links | Rich formatted responses | Recommended |
| Manage Messages | Delete or pin messages (moderation use case) | Optional |
Copy the generated URL and open it in your browser. Select the target server and authorize. The bot joins immediately with the exact permissions you specified.
Only request permissions your bot actively uses. Server admins scrutinize bot permission requests — an AI bot asking for Administrator permission raises immediate red flags. Start with the minimum set and request additional permissions only when you've identified a concrete need for them.
Running the Bot and Common Issues
Start your OpenClaw gateway and watch the logs for the Discord connection confirmation:
# Start the gateway
openclaw gateway start
# Expected log output:
# [discord] Connected to Discord gateway (shard 0)
# [discord] Registered 2 slash commands
# [discord] Listening for events in 1 server(s)
The bot is now live. Test it by using a slash command or mentioning the bot in a channel. If it responds, you're done. If not, check these common failure points:
- Bot appears offline — token is invalid or revoked. Regenerate in the developer portal and update OpenClaw config.
- Bot connects but ignores messages — Message Content Intent is disabled. Enable it in the developer portal Bot tab.
- Slash commands don't appear — Commands weren't registered, or you registered globally and are waiting for propagation. Use guild-scoped registration for instant results during testing.
- Bot joins server but can't send messages — Missing Send Messages permission in the channel. Check channel-level permission overrides in your Discord server settings.
- 403 errors in logs — Bot was invited without the
applications.commandsscope. Re-invite with the correct URL from the OAuth2 URL Generator.
Frequently Asked Questions
Do I need a verified Discord account to create a bot?
A standard Discord account is enough to create a bot in the developer portal. Verification is only required if your bot exceeds 100 servers. For a single-server or small community setup, create your application and generate a bot token immediately without any approval process.
Which gateway intents does OpenClaw need for Discord?
At minimum, enable Message Content Intent and Server Members Intent in the bot settings. Without Message Content, the bot cannot read messages. Without Server Members, it cannot resolve user details. Both are toggled in the developer portal under the Bot tab.
How do I add the OpenClaw Discord channel?
Run openclaw channels add discord in your CLI, then provide your bot token and application ID when prompted. OpenClaw registers the channel in your gateway config and starts the WebSocket connection. No Discord API code required on your end.
What permissions does my Discord bot need?
For a standard AI assistant bot: Send Messages, Read Message History, Use Slash Commands, and Embed Links. Add Manage Messages only if you need moderation features. Use the OAuth2 URL Generator to produce an invite URL with exactly those scopes — nothing more.
Why is my Discord bot showing as offline after setup?
The most common cause is an invalid or revoked bot token. Regenerate the token in the developer portal, update your OpenClaw config, and restart the gateway. Also confirm Message Content Intent is enabled — without it the bot connects but cannot process messages.
Can one OpenClaw instance serve multiple Discord servers?
Yes. A single bot application can be invited to multiple servers. Your OpenClaw gateway handles all incoming messages across every server from a single channel registration. You can scope responses to specific servers or channels by adding routing rules in your agent config.
R. Nakamura has built and deployed Discord bots for communities ranging from 200-member indie game servers to 50,000-member developer communities. Specializes in connecting Discord to AI agent pipelines and has documented every breaking change in the Discord API since gateway intents were introduced.