OpenClaw has 180,000+ GitHub stars and is used by thousands of developers and business owners worldwide. Learn more →
GuideHow to Build a Smart Discord Bot with OpenClaw — No Coding Required
Turn your Discord server into an AI-powered workspace. OpenClaw gives you a bot with buttons, forms, voice messages, role-based routing, moderation, and 5,700+ installable skills — all without writing a single line of code.
Traditional Discord bots are rigid. They respond to slash commands with canned answers, break when someone phrases a question differently, and require a developer to add new features. OpenClaw takes a fundamentally different approach: it connects a full AI agent — with memory, tool use, interactive components, and natural language understanding — directly to your Discord server via the official Bot API.
The result is a Discord bot that can hold real conversations, send interactive buttons and forms, moderate your server intelligently, summarize threads, send voice messages, route premium members to better AI models, and do basically anything you can describe in plain English. Setup takes about 10 minutes.
Why OpenClaw Makes a Better Discord Bot
Most Discord bots are single-purpose tools. MEE6 does moderation. Midjourney does images. Carl-bot does auto-roles. You end up with a dozen bots cluttering your server, none of which talk to each other.
OpenClaw replaces that entire stack with one agent that does all of it:
- Natural language, not slash commands. Ask questions in plain English. No memorizing
/commandsyntax. The bot understands context, follow-up questions, and ambiguous phrasing. (Native slash commands are supported too, enabled by default.) - Persistent memory. OpenClaw remembers previous conversations per channel and per user. Ask it something on Monday, reference it on Friday — it knows what you are talking about.
- Interactive UI with Components v2. Send buttons, dropdown menus, and modal forms directly in Discord. Build approval workflows, feedback forms, and structured inputs — not just text chat.
- Role-based agent routing. Route premium members to Claude Opus while free members get Haiku. Different roles, different AI models, different capabilities — all automatic.
- 5,700+ skills on ClawHub. Need web search? Image generation? GitHub integration? Install a skill with one command and your bot gains new abilities instantly.
- Voice messages. The bot can send Discord voice messages with waveform previews, just like a human would. Needs ffmpeg on your gateway host.
- Runs on your hardware. Your conversations stay on your server. No third-party data processing. No rate limits imposed by someone else's API.
The "closed loops" framework: The best Discord bots don't just chat — they produce artifacts. A PR review bot creates actionable diffs. A bug monitor opens issues and proposes fixes. A content bot drafts posts and schedules them. If your bot isn't creating assets you can trust, it's a demo, not a tool. OpenClaw is built for closed loops: trigger → context → action → artifact → guardrails.
OpenClaw Discord Bot Setup: Step by Step
Before you start, you need two things:
- A running OpenClaw Gateway. If you have not installed OpenClaw yet, follow the step-by-step install guide. You need Node 22+, an AI API key (Anthropic recommended), and about 5 minutes.
- A Discord server where you have admin permissions. You need the "Manage Server" permission to invite bots.
No Python, no JavaScript, no Docker (unless you want it). Just OpenClaw and a Discord server.
Step 1: Create a Bot on the Discord Developer Portal
Go to discord.com/developers/applications and click New Application. Give it a name (this will be your bot's display name). Navigate to the Bot section in the left sidebar and click Reset Token to generate a bot token. Copy this token immediately — you will not be able to see it again.
Step 2: Enable Required Intents
Still in the Bot settings, scroll down to Privileged Gateway Intents and enable:
- Message Content Intent — required. Without this, your bot cannot read message content.
- Server Members Intent — optional, but needed if you want role-based agent routing or member lookups.
Step 3: Invite the Bot to Your Server
Go to OAuth2 > URL Generator in the sidebar. Under Scopes, select bot. Under Bot Permissions, select at minimum:
- Send Messages
- Read Message History
- Add Reactions
- Use Slash Commands
- Attach Files (for voice messages and file sharing)
If you plan to use moderation features, also add: Moderate Members, Kick Members, Ban Members. Copy the generated URL, open it in your browser, and select your server.
Step 4: Connect to OpenClaw
Open your terminal and run:
openclaw channels add --channel discord --token "YOUR_BOT_TOKEN"
Replace YOUR_BOT_TOKEN with the token you copied in Step 1. OpenClaw connects to Discord's gateway and your bot should appear online in your server within seconds.
Alternatively, set the token as an environment variable (recommended for security):
export DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN"
openclaw gateway restart
Test it immediately
Go to any channel in your server and @mention your bot: @YourBot hello, are you working? — it should respond within a few seconds. If it does not, check the troubleshooting section at the bottom of this guide.
What Your Discord AI Bot Can Do
Here are specific things you can set up today — no coding required:
- Answer questions from your docs. Add your FAQ or documentation to the system prompt. Members ask "What's the rule about self-promotion?" and get an accurate answer.
- Summarize long threads. "Summarize the last 100 messages" — the bot reads history and produces a structured summary with key decisions and action items.
- Moderate intelligently. Timeout, kick, or ban based on rules you define in plain English. "If someone posts more than 5 messages in 10 seconds, timeout them for 5 minutes."
- Send interactive forms. Bug report forms, feedback surveys, approval workflows — all using Discord's native buttons and modals.
- Route premium members to better AI. Members with a "Premium" role get Claude Opus; everyone else gets Haiku. Automatic, based on Discord roles.
- Monitor for bugs and issues. Connect a Sentry or GitHub skill and the bot posts alerts, proposes fixes, and creates PRs — all in Discord.
- Generate images. "@Bot generate a logo for our hackathon, cyberpunk style with neon colors" — image posted right in the channel.
- Send voice messages. The bot can respond with Discord voice messages, complete with waveform previews.
- Draft announcements. "@Bot write an announcement for Friday game night" — polished, formatted, ready to post.
- Translate in real time. "@Bot translate this to Japanese: Welcome to our server!" — instant translation with pronunciation guide.
- Schedule content. Set up a content pipeline: scan trends, draft posts, schedule publishing — all coordinated through Discord.
- Onboard new members. Automatically greet new users, explain server rules, and answer their first questions in DMs.
- Run research. "@Bot what are the best React state management libraries in 2026?" — live web search with current comparisons.
- Review pull requests. The bot reads diffs, flags missing tests, risky changes, and security issues — posts reviews directly in your dev channel.
Think "AI employee," not "chatbot." The most successful Discord bot setups treat OpenClaw as a team member with defined responsibilities: community support lead, content scheduler, bug monitor, or onboarding specialist. Give it a clear role in your system prompt and it becomes genuinely useful, not just a novelty.
Discord AI Bot No Code: Components v2 — Buttons, Forms, and Menus
This is the feature most people don't know about. OpenClaw supports Discord's components v2, which means your bot can send rich interactive messages — not just text.
Buttons and Select Menus
Your bot can send messages with action buttons (approve/decline, priority selection) and dropdown menus. When a user clicks a button or selects an option, the interaction is routed back to the agent as a normal message.
{
"channel": "discord",
"action": "send",
"target": "channel:123456789012345678",
"components": {
"text": "New support ticket from @user",
"blocks": [
{
"type": "actions",
"buttons": [
{ "label": "Approve", "style": "success" },
{ "label": "Decline", "style": "danger" }
]
},
{
"type": "actions",
"select": {
"type": "string",
"placeholder": "Assign priority",
"options": [
{ "label": "Low", "value": "low" },
{ "label": "Medium", "value": "medium" },
{ "label": "High", "value": "high" }
]
}
}
]
}
}
Supported select types include string, user, role, mentionable, and channel — so you can build menus that let users pick team members, roles, or channels natively.
I walk through my full bot setup and the automations I actually use in a free guide.
Modal Forms
Need structured input? Modal forms pop up as Discord dialogs with up to 5 fields. OpenClaw adds a trigger button automatically.
{
"components": {
"text": "Submit a bug report",
"modal": {
"title": "Bug Report",
"triggerLabel": "Report Bug",
"fields": [
{ "type": "text", "label": "What happened?" },
{ "type": "text", "label": "Steps to reproduce" },
{
"type": "select",
"label": "Severity",
"options": [
{ "label": "Minor", "value": "minor" },
{ "label": "Major", "value": "major" },
{ "label": "Critical", "value": "critical" }
]
}
]
}
}
}
Field types include text, checkbox, radio, select, role-select, and user-select. This turns your Discord bot into a full application — feedback forms, onboarding surveys, feature requests, all with native Discord UI.
Accent color
Customize the color of component containers with channels.discord.ui.components.accentColor — set it to your brand's hex color (e.g., "#5865F2" for Discord blurple).
Voice Messages
OpenClaw can send Discord voice messages with the native waveform preview, just like a human sending a voice note. This is useful for announcements, TTS responses, or accessibility.
Requirements:
ffmpegandffprobeinstalled on the gateway host- A local audio file path (URLs are rejected)
- No text content in the same message (Discord limitation)
Any audio format is accepted — OpenClaw converts to OGG/Opus automatically and generates the waveform.
message(action="send", channel="discord", target="channel:123",
path="/path/to/audio.mp3", asVoice=true)
Combine this with a TTS skill and your bot can speak its responses as voice messages instead of (or in addition to) text.
Configuring Personality and System Prompt
The system prompt tells the bot who it is, how to behave, and what it knows. You write it in plain English. Here is an example for a developer community server:
You are DevHelper, the AI assistant for the Acme Dev Community Discord server.
Your role:
- Answer programming questions clearly and concisely
- Help debug code when members paste error messages
- Summarize long discussions when asked
- Review code snippets for bugs and best practices
- Use buttons for approval workflows (approve/reject PRs)
- Use forms for bug reports and feature requests
Rules:
- Never share or generate API keys, passwords, or credentials
- If you don't know the answer, say so honestly
- Keep responses under 2000 characters (Discord's message limit)
- Use code blocks for any code snippets
- Use components v2 (buttons/forms) when structured input is needed
To set this, edit the system prompt in your ~/.openclaw/openclaw.json config file or use the OpenClaw dashboard at http://127.0.0.1:18789.
Deep dive: System prompts can make or break your bot's usefulness. Read the full OpenClaw System Prompt Guide for advanced techniques like role-gating, persona switching, and context injection.
OpenClaw Discord Moderation
OpenClaw supports Discord moderation actions natively: timeout, kick, and ban. These are disabled by default for safety. To enable them:
{
"channels": {
"discord": {
"actions": {
"moderation": "enabled"
}
}
}
}
Once enabled, you can tell the bot things like "timeout @spammer for 10 minutes, they're posting links in every channel" and it will execute the action. You can also define automatic moderation rules in the system prompt.
Available action gates (all configurable under channels.discord.actions.*):
| Action Category | Default | Includes |
|---|---|---|
| messages | enabled | sendMessage, readMessages, editMessage, deleteMessage, threadReply |
| reactions | enabled | react, reactions, emojiList |
| threads, pins, polls, search | enabled | Thread management, pinning, polls, message search |
| moderation | disabled | timeout, kick, ban |
| roles | disabled | Role assignment and management |
| presence | disabled | setPresence (bot status) |
| channels | enabled | Channel info and management |
Be careful with moderation. An AI making moderation decisions can go wrong. Start with timeout-only permissions (no kicks or bans) and monitor the bot's decisions for a few days before expanding its authority. Make sure the bot's role is higher in the server role hierarchy than the users it needs to moderate.
Advanced: Guild Configuration and Access Control
This is where OpenClaw's Discord integration gets seriously powerful. You have fine-grained control over who can talk to the bot, in which channels, and what model they get.
Guild Allowlist Configuration
Here is a complete guild setup with channel allowlists, role restrictions, and mention requirements:
{
"channels": {
"discord": {
"groupPolicy": "allowlist",
"guilds": {
"123456789012345678": {
"requireMention": true,
"users": ["987654321098765432"],
"roles": ["111111111111111111"],
"channels": {
"general": { "allow": true, "requireMention": true },
"support": { "allow": true, "requireMention": false },
"admin": { "allow": true }
}
}
}
}
}
}
In this example:
- #general — bot responds only when @mentioned
- #support — bot responds to every message (great for a help desk)
- #admin — bot responds when @mentioned, inheriting the guild default
- Only users matching the
usersorroleslists can interact with the bot - Channels not listed are denied
If you only set DISCORD_BOT_TOKEN and don't create a channels.discord block, the fallback is groupPolicy="open" (with a warning in logs).
Role-Based Agent Routing
Route different Discord roles to different AI agents with different models, system prompts, and capabilities. This is the killer feature for communities with paid tiers:
{
"bindings": [
{
"agentId": "opus-agent",
"match": {
"channel": "discord",
"guildId": "123456789012345678",
"roles": ["PREMIUM_ROLE_ID"]
}
},
{
"agentId": "sonnet-agent",
"match": {
"channel": "discord",
"guildId": "123456789012345678"
}
}
]
}
Members with the "Premium" role get routed to Claude Opus (smarter, more capable). Everyone else gets Sonnet or Haiku (faster, cheaper). The routing is automatic — members just talk normally and get the right model. You could even route your mod team to an agent with moderation actions enabled while keeping those disabled for everyone else.
DM Access Control
Control who can DM the bot directly with channels.discord.dmPolicy:
- pairing (default) — unknown users get a pairing prompt before they can chat
- allowlist — only pre-approved users can DM
- open — anyone can DM (requires
allowFrom: "*") - disabled — no DMs at all
By default, DMs share the main agent session (agent:main:main). Group DMs are ignored by default but can be enabled with dm.groupEnabled and allowlisted via dm.groupChannels.
Native Slash Commands
Slash commands are enabled by default (commands.native = "auto"). OpenClaw registers them automatically with Discord's API. Each slash command runs in an isolated session but carries the conversation context. Slash command auth uses the same allowlists and policies as regular messages — commands may be visible in Discord UI for unauthorized users, but execution will return "not authorized."
To disable slash commands: set commands.native = false. This also clears any previously registered commands.
Adding Skills: Search, Images, and More
Skills are what turn your Discord bot from a chatbot into a capable assistant. ClawHub has over 5,700 skills you can install with a single command:
# Web search — answer questions with live internet data
openclaw skills install web-search
# Image generation — create images from text descriptions
openclaw skills install image-gen
# GitHub integration — manage issues, PRs, repos from Discord
openclaw skills install github
Each skill you install gives your bot a new capability immediately. No restart needed. Skills have proper YAML frontmatter (name + description) — if they're missing, OpenClaw won't load them. Verify with openclaw skills list --json.
Troubleshooting Common Issues
Bot appears offline
- Check that OpenClaw is running:
openclaw gateway status - Verify the Discord channel is connected:
openclaw channels status --probe - Make sure your bot token is correct and has not been regenerated on the Developer Portal
Bot is online but not responding
- Most common cause: Message Content Intent is not enabled on the Developer Portal. Go to Bot settings and toggle it on.
- Check if
requireMentionis true for the channel. Try @mentioning the bot directly. - Verify your AI API key has credits:
openclaw status - Check logs for errors:
openclaw logs --tail 50
Bot responds in some channels but not others
- If
groupPolicyis set toallowlist, only channels listed in yourguilds.*.channelsconfig are active - Check that the bot has "View Channel" and "Send Messages" permissions in the target channel
- If the channel is a thread, ensure the bot has the right to participate in threads
Slash commands not appearing
- OpenClaw registers native slash commands automatically when
commands.nativeis set to"auto"(the default) - Discord caches commands. Wait up to an hour, or try restarting the gateway:
openclaw gateway restart - To force re-registration, restart the gateway and check with
openclaw channels status --probe
Moderation actions not working
- Moderation is disabled by default. Set
channels.discord.actions.moderationto"enabled"in your config - Make sure the bot's role is higher in the role hierarchy than the users it is trying to moderate
- Verify the bot has the required permissions (Moderate Members, Kick Members, etc.) in the server
Voice messages not working
- Install
ffmpegandffprobeon the gateway host - Voice messages require a local file path — URLs are rejected
- You cannot send text and a voice message in the same payload
Quick diagnostic
Run openclaw channels status --probe for a full health check of your Discord connection. It shows connection state, registered commands, and any configuration warnings.
FAQ
Can OpenClaw run as a Discord bot?
Yes. OpenClaw connects to Discord via the official Bot API. You create a bot on the Discord Developer Portal, copy the token, and run one command to connect it. OpenClaw then responds to messages in DMs and guild channels with full AI capabilities including tool use, memory, skills, interactive buttons, forms, and voice messages.
Is the OpenClaw Discord bot free?
OpenClaw itself is 100% free and open source (MIT license, 180,000+ GitHub stars). You need an AI API key (Anthropic, OpenAI, or Groq) which typically costs $0.50–3.00 per day for moderate Discord server usage. You can also run it for free using Ollama with local models, or use budget providers like MiniMax for around $10/month.
How do I add AI to my Discord server?
Install OpenClaw (requires Node 22+), create a bot on the Discord Developer Portal, enable Message Content Intent, invite the bot to your server, then run openclaw channels add --channel discord --token YOUR_TOKEN. The entire process takes under 10 minutes and requires no coding.
Can the bot moderate my server?
Yes. OpenClaw supports Discord moderation actions including timeout, kick, and ban. These are disabled by default for safety. Enable them in your config under channels.discord.actions.moderation. The bot can then moderate based on rules you define in plain English in its system prompt.
Does it support slash commands?
Yes. Native Discord slash commands are enabled by default (commands.native = "auto"). OpenClaw registers them automatically with the Discord API. Slash commands run in isolated sessions and respect the same access control policies as regular messages.
Can the OpenClaw bot work in multiple Discord channels at once?
Yes. Each Discord channel gets its own isolated session, so conversations do not bleed between channels. You can configure which channels the bot responds in, whether it requires @mentions, and even route different channels or roles to different AI agents with different models and capabilities.
Related Guides
- How to Install OpenClaw — get OpenClaw running before connecting Discord
- OpenClaw System Prompt Guide — craft the perfect personality for your bot
- Best OpenClaw Skills to Install — extend your bot with moderation, search, image gen, and more
- OpenClaw WhatsApp & Telegram Setup — connect the same agent to other messaging platforms
- OpenClaw Use Cases — 15 things your AI agent can do beyond Discord
- OpenClaw Skills & ClawHub Guide — deep dive into the skill marketplace
Free: The AI Growth Breakdown
See how one business went from 0 to 600 daily visitors in 14 days using AI. The exact tools and results.
Get the Free Breakdown →