Discord is where communities live. If you run a server for your team, your community, or just yourself, connecting OpenClaw turns it into an always-on AI workspace. Every channel gets its own agent session. Every DM gets instant responses. Here is the complete setup, from bot creation to guild configuration.
What You'll Find in This Guide
Why Run OpenClaw on Discord
Most AI Discord bots are glorified chatbots. You type a prompt, you get a response, end of story. OpenClaw is different because it runs as a full agent with memory, tools, file access, cron jobs, and skills.
On Discord specifically, you get features that other channels don't offer:
- Per-channel sessions. Each Discord channel gets its own isolated agent session with its own context. Your #research channel stays separate from #content-ideas.
- Thread support. Spawn sub-agents in threads for focused work without cluttering the main channel.
- Guild workspace mode. Turn your entire server into a workspace where the bot responds in every channel without needing @mentions.
- Slash commands. Native Discord commands like
/status,/vc join, and/reasoningwork alongside natural language.
I run 13 agents on a single Mac Mini. Discord is one of the channels I use daily for project coordination. Here is exactly how to set it up.
Step 1: Create Your Discord Bot Application
Go to the Discord Developer Portal and click New Application.
Name it whatever you want. I called mine "Marc" because that is my agent's name. You can change it later.
Click Bot on the left sidebar. Set the Username to your agent's name. This is what shows up in your server.
Tip: If you don't have a Discord server yet, create one first. Go to Discord, click the + icon on the left sidebar, choose "Create My Own" then "For me and my friends." You need a server before you can add the bot.
Step 2: Enable Privileged Gateway Intents
Still on the Bot page in the Developer Portal, scroll down to Privileged Gateway Intents. You need to enable these:
| Intent | Required? | Why |
|---|---|---|
| Message Content Intent | Yes | Without this, the bot cannot read messages. Nothing works. |
| Server Members Intent | Recommended | Required for role-based allowlists and matching usernames to IDs. |
| Presence Intent | Optional | Only needed if you want presence updates. Most setups skip this. |
Toggle them on and save. The Message Content Intent is non-negotiable. Without it, your bot receives empty messages.
Step 3: Generate the Invite URL and Add the Bot
Click OAuth2 on the left sidebar. Scroll down to OAuth2 URL Generator.
Check these scopes:
botapplications.commands
A Bot Permissions section appears below. Enable:
- View Channels
- Send Messages
- Read Message History
- Embed Links
- Attach Files
- Add Reactions (optional but nice)
Copy the generated URL at the bottom. Paste it into your browser. Select your server. Click Continue.
Your bot should now appear in the server member list. It will be offline until you connect OpenClaw.
Step 4: Connect OpenClaw to Your Discord Bot
Before connecting, you need your bot token. Go back to the Bot page in the Developer Portal and click Reset Token. Despite the scary name, this just generates your first token. Copy it immediately. You will not see it again.
Never share your bot token. Anyone with this token can control your bot. Treat it like a password. Don't paste it in Discord messages or public channels.
On the machine running OpenClaw, set the token via CLI:
openclaw config set channels.discord.token '"YOUR_BOT_TOKEN"' --json
openclaw config set channels.discord.enabled true --json
openclaw gateway restart
If OpenClaw is not running yet, use openclaw gateway start instead of restart.
You can also set it in your openclaw.json config file directly:
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN"
}
}
}
Need help installing OpenClaw first? Start at installopenclawnow.com for the fastest path.
Step 5: Pair Your Discord Account
Once the gateway is running with Discord enabled, open Discord and DM your bot directly.
The bot will reply with a pairing code. This code links your Discord account to your OpenClaw identity.
To approve the pairing, you have two options:
Option A: Tell your agent on another channel (like Telegram): "Approve this Discord pairing code: ABC123"
Option B: Use the CLI:
openclaw pairing list discord
openclaw pairing approve discord ABC123
Pairing codes expire after 1 hour. Once approved, you can chat with your agent in Discord DMs.
DMs not working? Right-click your server icon, go to Privacy Settings, and toggle on "Direct Messages." This lets server members (including bots) DM you. You can disable it after pairing if you only want to use guild channels.
Step 6: Set Up Your Guild as a Full Workspace
DMs are great, but the real power is running OpenClaw across your entire server. Each channel becomes its own agent session with isolated context.
First, you need your Server ID and User ID. Enable Developer Mode in Discord: User Settings (gear icon) then Advanced then toggle Developer Mode. Then right-click your server icon and select "Copy Server ID." Right-click your own avatar for your User ID.
Add your server to the guild allowlist. Tell your agent:
"Add my Discord Server ID 123456789 to the guild allowlist"
Or set it in config:
{
"channels": {
"discord": {
"groupPolicy": "allowlist",
"guilds": {
"YOUR_SERVER_ID": {
"requireMention": true,
"users": ["YOUR_USER_ID"]
}
}
}
}
}
With requireMention: true, the bot only responds when you @mention it. Set it to false if you want it to respond to every message in every channel. I recommend keeping mentions on for busy servers and turning them off for private workspaces.
Access Control and Allowlists
OpenClaw gives you fine-grained control over who can talk to your bot:
- User allowlist: Only specific Discord User IDs can interact with the bot. Everyone else gets ignored.
- Role allowlists: Allow anyone with a specific Discord role. Requires the Server Members Intent.
- Channel restrictions: Limit the bot to specific channels instead of the whole server.
- Group policy: Set to "allowlist" (explicit opt-in) or "open" (everyone in the server can use it).
For a personal server where it is just you and the bot, the config above is all you need. For community servers, lock it down with role-based access so only moderators or specific members can trigger the agent.
Pro tip: Create a dedicated "AI" role in your Discord server. Add it to the allowlist. Assign it to yourself and anyone you trust. This makes adding or removing access easy without touching config files.
Multi-Channel Agent Routing
One of Discord's biggest advantages over other channels: you can route different agents to different channels within the same server.
Example setup for a content team:
{
"channels": {
"discord": {
"guilds": {
"YOUR_SERVER_ID": {
"channels": {
"research-channel-id": { "agentId": "research" },
"content-channel-id": { "agentId": "writer" },
"analytics-channel-id": { "agentId": "analytics" }
}
}
}
}
}
}
Each channel gets a dedicated agent with its own SOUL.md, skills, and memory. The research agent has web search and summarization skills. The writer agent has your content templates and voice guide. The analytics agent has access to your data sources.
Sessions are isolated per channel. What happens in #research stays in #research. The analytics agent cannot see the content drafts. This keeps conversations focused and prevents context pollution.
Useful Slash Commands
OpenClaw registers several slash commands with Discord. These work alongside natural language messaging:
/status: Shows the current agent status, model, and session info. Good for checking if the bot is connected and responsive./reasoning on//reasoning off: Toggle extended thinking mode. When on, the agent shows its reasoning process alongside the response. Useful for debugging complex tasks./vc join: Joins a voice channel for real-time voice interaction. The agent listens, transcribes, and responds using TTS. Experimental but functional for hands-free usage./model: Switch the active AI model mid-conversation. Useful when you want a cheaper model for simple tasks or a more powerful one for complex reasoning.
Slash commands are registered when the bot connects. If they do not show up, wait a few minutes. Discord caches command registration and it can take up to an hour to propagate globally.
Discord vs Telegram vs WhatsApp for OpenClaw
All three channels work with OpenClaw. Here is when Discord makes the most sense:
| Feature | Discord | Telegram | |
|---|---|---|---|
| Per-channel sessions | Yes | Via forum topics | No |
| Thread support | Native | Forum topics | No |
| Slash commands | Yes | Bot commands | No |
| File sharing | Excellent | Good | Limited |
| Voice channels | Yes (/vc join) | No | No |
| Mobile experience | Good | Great | Great |
| Setup complexity | Medium | Easy | Easy |
Use Discord if you want organized channel-based workflows or if your team already lives there. Use Telegram if you want the fastest mobile experience. Use WhatsApp if you want to chat with your agent the same way you text friends.
Nothing stops you from running all three simultaneously. Same agent, multiple channels, shared memory.
Common Issues and Fixes
Bot is online but not responding: Check that Message Content Intent is enabled in the Developer Portal. This is the #1 issue. Without it, the bot receives messages with empty content.
Pairing code not appearing: Make sure DMs are enabled on your server. Right-click the server icon, then Privacy Settings, then Direct Messages, then toggle On.
Bot responds in DMs but not in channels: You need to add the server to the guild allowlist. See Step 6 above. The bot defaults to DM-only mode.
"Missing Access" errors: The bot needs View Channels and Send Messages permissions in the specific channel. Check the channel's permission overrides in Discord server settings.
Gateway not starting after adding Discord: Verify your bot token is correct. A single extra space or missing character will cause authentication failure. Re-copy the token from the Developer Portal.
Advanced: Thread-Based Sub-Agent Workflows
Discord threads are perfect for isolating complex tasks. Here is how to use them with OpenClaw:
When your agent needs to handle a long-running task (research, content creation, debugging), it can create a Discord thread and work inside it. The main channel stays clean. All the back-and-forth happens in the thread.
You can also spawn ACP (Agent Control Protocol) sub-agents directly into threads. Tell your agent: "Spawn a research agent in a new thread to investigate [topic]." The sub-agent gets its own session, does the work, and reports back. When done, the thread serves as a permanent record of the research.
This pattern works well for teams. A team member posts a request in the main channel. The bot creates a thread, handles the task, and posts the result. The main channel stays readable. The thread has the full context if anyone needs to review it later.
For a full guide on multi-agent workflows, check our multiple agents setup guide.
For more detailed troubleshooting, check the complete OpenClaw troubleshooting guide.
Frequently Asked Questions
How do I set up an OpenClaw Discord bot?
Create a Discord application at discord.com/developers, add a bot, copy the bot token, and configure it in your OpenClaw gateway settings. Enable the necessary intents (message content, guild messages) and invite the bot to your server.
What can an OpenClaw Discord bot do?
An OpenClaw Discord bot can respond to messages, answer questions, moderate content, run commands, search the web, manage files, and execute scheduled tasks. It has full access to OpenClaw's tools including browser automation and code execution.
Can OpenClaw run a Discord bot for my community?
Yes, OpenClaw can power a Discord bot that helps manage your community. It can answer FAQs, welcome new members, moderate discussions, run scheduled announcements, and provide support. The bot uses AI reasoning to handle complex questions.
How do I configure OpenClaw to respond in Discord channels?
Configure channel routing in your OpenClaw gateway config to specify which channels the bot monitors. You can set it to respond to direct mentions, DMs, or all messages in specific channels. Use agent routing to assign different agents to different channels.
Can I use OpenClaw with both Discord and Telegram?
Yes, OpenClaw supports multiple messaging channels simultaneously. You can run Discord and Telegram (and other channels) at the same time, all connected to the same agent or routed to different agents based on your configuration.
OpenClaw Lab is the #1 community for founders building AI agent systems. I share the exact playbooks, skill files, and workflows inside. Weekly lives, expert AMAs, and 260+ founders building real systems.
Join OpenClaw Lab →