How to Set Up an OpenClaw Discord Bot with Slash Commands (2026)
This guide walks through every step of connecting OpenClaw to Discord — from creating your bot application to configuring slash commands and troubleshooting the most common issues.
Want to skip all of this? NeatClaw connects to Discord with a single OAuth click — no Developer Portal, no token management, no configuration files.
Prerequisites
- A Discord account
- "Manage Server" permission on the target Discord server
- OpenClaw installed and running (or use NeatClaw to skip installation)
Estimated time: 10–15 minutes
Step 1: Create a Discord Application
- Open the Discord Developer Portal
- Click New Application in the top right
- Name your application (e.g., "OpenClaw Assistant")
- Accept Discord's Terms of Service
- Click Create
What is a Discord Application? Think of it as a registered identity for your bot — similar to creating a developer account, but for automated software.
Step 2: Create the Bot User and Get Your Token
- In your application, click Bot in the left sidebar
- Click Add Bot → Yes, do it!
- Under Token, click Reset Token → Yes, do it!
- Click Copy to save your token
Security: Your bot token is equivalent to a password. Never share it publicly or commit it to a repository.
Token format: MTk4NjIyNDgzNDk0MjE3MjE2.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs
Step 3: Configure Bot Permissions
Still in the Bot section, scroll down to Privileged Gateway Intents and enable:
| Intent | Why It's Required |
|---|---|
| ☑ Presence Intent | See user online status |
| ☑ Server Members Intent | See who's in the server |
| ☑ Message Content Intent | Critical — read what users type |
Warning: Without Message Content Intent, your bot will appear online but will never respond to messages. This is the #1 Discord setup mistake.
Click Save Changes at the bottom.
Step 4: Add the Bot to Your Server
- Click OAuth2 → URL Generator in the left sidebar
- Under Scopes, select:
- ☑
bot - ☑
applications.commands(required for slash commands)
- ☑
- Under Bot Permissions, select:
- ☑ Send Messages
- ☑ Send Messages in Threads
- ☑ Embed Links
- ☑ Attach Files
- ☑ Read Message History
- ☑ Add Reactions
- ☑ Use Slash Commands
- Copy the generated URL at the bottom
- Paste it in your browser, select your server, click Authorize
Your bot will appear in the server member list (offline until OpenClaw connects).
Step 5: Configure OpenClaw
Update your .env file
# ~/.openclaw/.env
DISCORD_BOT_TOKEN=your-bot-token-here
Update config.json
{
"channels": {
"discord": {
"enabled": true,
"features": ["text", "embeds", "reactions", "files"],
"allowedGuilds": [],
"allowedChannels": [],
"slashCommands": true,
"prefix": "!",
"autoReply": true,
"typingIndicator": true
}
}
}
Key settings explained:
allowedGuilds: []— empty means all servers; add server IDs to restrictallowedChannels: []— empty means all channels; add channel IDs to restrictslashCommands: true— enables/commandstypingIndicator: true— shows "Bot is typing..." while processing
Restart OpenClaw
openclaw stop
openclaw start
openclaw logs # Should show: Discord bot connected successfully
Step 6: Set Up Slash Commands
{
"channels": {
"discord": {
"slashCommands": true,
"commands": [
{
"name": "ask",
"description": "Ask the AI assistant a question",
"options": [
{
"name": "question",
"description": "Your question",
"type": "string",
"required": true
}
]
},
{
"name": "reset",
"description": "Clear conversation memory"
},
{
"name": "help",
"description": "Show available commands"
}
]
}
}
}
After saving, run openclaw restart. Slash commands take 1–5 minutes to appear in Discord.
Testing Your Bot
- Message test: Type a message in any channel where the bot has access. If
autoReply: true, it should respond. - Slash command test: Type
/askand submit a question. The bot should reply. - Permission test: Send an image, a file, and a reaction — verify each works.
Troubleshooting
Bot is online but doesn't respond to messages
This is almost always a Message Content Intent issue.
- Go to Discord Developer Portal
- Your Application → Bot → Privileged Gateway Intents
- Enable Message Content Intent
- Save, restart OpenClaw
Slash commands don't appear
- Wait 1–5 minutes — Discord propagates commands on their own schedule
- Ensure
applications.commandsscope was selected when inviting the bot - Fully quit and reopen the Discord app (not just refresh)
- Check
openclaw logsfor command registration errors
Bot shows "Missing Access" errors
The bot needs Send Messages permission in that specific channel:
- Right-click the channel → Edit Channel → Permissions
- Add the bot role with Send Messages enabled
Advanced Discord Features
Thread Support
{
"discord": {
"features": ["threads"],
"autoCreateThreads": true,
"threadPrefix": "AI Chat —"
}
}
Custom Rich Embeds
{
"discord": {
"embedStyle": {
"color": "#5865F2",
"footer": "Powered by OpenClaw"
}
}
}
Reaction Controls
{
"discord": {
"reactionControls": {
"enabled": true,
"reactions": {
"👍": "positive_feedback",
"🔄": "regenerate_response"
}
}
}
}
The 1-Click Alternative
Setting up Discord manually requires: creating a Developer Application, configuring 10+ permissions, managing OAuth2 URLs, editing config files, troubleshooting gateway intents, and registering slash commands.
NeatClaw reduces this to:
- Click Connect Discord
- Authorize with Discord (OAuth2)
- Select your server
- Done — bot is online with slash commands pre-configured
Get 1-click Discord setup with NeatClaw
Sources: Discord Developer Documentation, OpenClaw Discord Integration Docs