Setup & Deployment
How to Set Up OpenClaw as a Discord Bot in 5 Steps (2026 Guide)
4 min read · Updated 2026-03-08
By DoneClaw Team · We run managed OpenClaw deployments and write from hands-on production experience.
Discord is where communities live — and with OpenClaw, you can bring your AI agent into any server. Whether it's a personal bot for DMs, a helpful assistant in your team's server, or a community tool, this guide gets you set up.
Why Discord?
Compared to Telegram and WhatsApp, Discord offers several advantages for running an AI agent.
Best for: developer communities, gaming groups, team collaboration, and anyone already on Discord.
- **Rich formatting** — Code blocks, embeds, reactions, threads
- **Server/channel structure** — Route your agent to specific channels
- **Slash commands** — Native Discord command integration
- **Voice channel awareness** — Know who's in calls
- **Bot ecosystem** — Discord users expect bots; it's a natural fit
Step 1: Create a Discord Bot
Start by creating your bot application in the Discord Developer Portal.
- Go to the Discord Developer Portal
- Click "New Application" and name it (e.g., "MyAgent")
- Go to the **Bot** tab and click "Add Bot"
- Copy the **Bot Token** (keep this secret!)
- Under "Privileged Gateway Intents," enable **Message Content Intent** (required to read messages) and optionally **Server Members Intent** (for member info)
Step 2: Invite the Bot to Your Server
Generate an invite URL with the correct permissions and add the bot to your server.
- Go to the **OAuth2 → URL Generator** tab
- Select scopes: `bot`, `applications.commands`
- Select permissions: `Send Messages`, `Read Message History`, `Add Reactions`, `Use Slash Commands`
- Copy the generated URL and open it in your browser
- Select your server and authorize
Step 3: Configure OpenClaw
Set the Discord bot token, configure allowed channels, and restart the gateway. Your bot should come online in Discord within seconds.
# Set the Discord bot token
openclaw config set channels.discord.token YOUR_BOT_TOKEN
# Set which channels the bot responds in (optional)
openclaw config set channels.discord.allowedChannels '["general", "bot-chat"]'
# Restart the gateway
openclaw gateway restartStep 4: Test It
In any allowed channel (or DM), message the bot: @YourBot what time is it?
Or in DMs, just type normally — no mention needed.
The bot should respond with your agent's personality (defined in SOUL.md).
Message Routing Options
**DMs Only (Private Assistant)** — Your bot only responds in direct messages. Safest option for personal use.
**Specific Channels** — Bot responds only when mentioned (@bot) in specific channels.
**Full Server Access** — Bot sees all messages in allowed channels. Be careful — this uses more API tokens and the agent might respond when it shouldn't. Configure your SOUL.md with clear guidelines about when to stay silent.
# DMs Only
openclaw config set channels.discord.routing.dm true
openclaw config set channels.discord.routing.servers false
# Specific Channels
openclaw config set channels.discord.routing.servers true
openclaw config set channels.discord.routing.mentionOnly true
openclaw config set channels.discord.allowedChannels '["bot-chat", "help"]'
# Full Server Access
openclaw config set channels.discord.routing.servers true
openclaw config set channels.discord.routing.mentionOnly falseSkip 60 minutes of setup — deploy in 60 seconds
DoneClaw handles Docker, servers, security, and updates. Your OpenClaw agent is ready to chat in under a minute.
Deploy NowConfiguring Behavior for Discord
Add Discord-specific guidelines to your SOUL.md to control how the agent behaves in Discord channels.
## Discord Behavior
- Use code blocks for technical content
- Keep responses under 2000 characters (Discord's limit)
- React with emoji instead of responding when a simple acknowledgment is enough
- In group channels, only respond when directly relevant
- Use threads for long conversations
- Don't use markdown tables — use bullet lists instead
- Wrap multiple links in <> to suppress embedsPractical Use Cases
**Community Help Bot** — Set up your agent in a #help channel to answer questions about OpenClaw, coding, and tech. Configure it to be concise and link to docs when relevant.
**Team Productivity Bot** — In a work server, use it to summarize today's messages in #general, extract action items from standup threads, or draft project updates based on the week's activity.
**Personal DM Assistant** — Same as using Telegram or WhatsApp — but through Discord. Check email and calendar, set reminders, research topics, and draft content.
Reactions and Formatting
OpenClaw supports Discord-native features for richer interactions.
- **Reactions** — The agent can react to messages with emoji (acknowledgment without cluttering chat)
- **Embeds** — Rich formatted responses for structured data
- **Code blocks** — Automatic syntax highlighting for code
- **Threads** — Long conversations can move to threads to keep channels clean
Slash Commands (Optional)
If you want Discord's native slash command UI, enable it in the config. This registers commands like /ask, /remind, /search that users can discover through Discord's command menu.
openclaw config set channels.discord.slashCommands true
openclaw gateway restartPerformance and Costs
Every message the bot processes costs API tokens. In active servers, this adds up fast. Expect 2-5 seconds latency for most responses, longer for complex queries with tool use.
Tips to control costs:
- Use `mentionOnly: true` in busy channels
- Set a cheaper model for simple queries
- Use token cost reduction strategies
- Monitor with `openclaw status`
Troubleshooting
Bot shows offline: Check token is correct; run `openclaw gateway status`.
Bot doesn't respond: Verify Message Content Intent is enabled in Developer Portal.
"Missing permissions" error: Re-invite bot with correct permissions.
Bot responds to everything: Set `mentionOnly: true` and configure `allowedChannels`.
Responses cut off: Discord has a 2000-char limit; configure agent to be concise.
Security Considerations
Keep your bot token secret — anyone with it can control your bot. Limit channel access so the bot doesn't see channels with sensitive info unless needed. Be aware that messages in server channels are visible to all members, so your agent might reference personal data if not configured carefully. Use isolated sessions for servers to keep server conversations separate from your personal DM session.
For full security setup, see our hardening checklist.
Conclusion
Prefer a different platform? Check our guides for Telegram and WhatsApp, or compare all three in our channel comparison.
Skip the setup? DoneClaw deploys OpenClaw for you — $29/mo with 7-day free trial, zero configuration.
Skip 60 minutes of setup — deploy in 60 seconds
DoneClaw handles Docker, servers, security, and updates. Your OpenClaw agent is ready to chat in under a minute.
Deploy NowFrequently asked questions
Does my Discord bot need any special permissions to work with OpenClaw?
Yes. Your bot needs Message Content Intent enabled in the Discord Developer Portal (required to read messages), plus the permissions Send Messages, Read Message History, Add Reactions, and Use Slash Commands. Without Message Content Intent, the bot won't be able to see or respond to messages.
Can I limit my OpenClaw Discord bot to only respond in DMs?
Yes. Set channels.discord.routing.dm to true and channels.discord.routing.servers to false. This makes your bot a private assistant that only responds in direct messages, which is the safest option for personal use and helps control API token costs.
How much does running an OpenClaw Discord bot cost in API tokens?
Every message the bot processes costs API tokens, and in active servers this adds up fast. To control costs, use mentionOnly mode in busy channels so the bot only responds when mentioned, set a cheaper model for simple queries, and monitor usage with openclaw status.
Why is my OpenClaw Discord bot showing as offline?
The most common cause is an incorrect bot token. Verify your token is correct and run openclaw gateway status to check the gateway. Also ensure Message Content Intent is enabled in the Discord Developer Portal — without it, the bot can't function properly.
Can I use slash commands with my OpenClaw Discord bot?
Yes. Enable slash commands by running openclaw config set channels.discord.slashCommands true and restarting the gateway. This registers commands like /ask, /remind, and /search that users can discover through Discord's native command menu.