Clawdbot Discord Integration
Connect Clawdbot AI assistant to Discord for intelligent bot automation, server management, and AI-powered conversations in your Discord community.
Clawdbot Discord Integration Overview
Clawdbot Discord integration enables you to bring AI-powered assistance to your Discord servers using the official Discord bot gateway. This is ready for DM and guild text channels.
Why Use Clawdbot with Discord?
Discord is the leading platform for gaming and community communication. Integrating Clawdbot with Discord offers:
| Feature | Clawdbot Discord Benefit |
|---|---|
| Server Integration | Clawdbot Discord works across multiple servers |
| Slash Commands | Native Discord slash command support |
| DM + Guild Support | Direct chats share main session; guild channels stay isolated |
| Role-Based Access | Control Clawdbot Discord access by Discord roles |
| Deterministic Routing | Replies always go back to the channel they arrived on |
Quick Setup (Beginner)
- Create a Discord bot and copy the bot token
- In the Discord app settings, enable Message Content Intent (and Server Members Intent if needed)
- Set the token via env (
DISCORD_BOT_TOKEN=...) or config (channels.discord.token) - Invite the bot to your server with message permissions
- Start the gateway
- DM access is pairing by default; approve the pairing code on first contact
Minimal config:
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN"
}
}
}Setting Up Clawdbot Discord
Prerequisites
Before connecting Clawdbot to Discord, ensure you have:
- Clawdbot installed on your device
- A Discord account
- Discord Developer Portal access
- Server administrator permissions
Step 1: Create a Discord Application
Set up your Clawdbot Discord application:
- Go to Discord Developer Portal
- Click "New Application"
- In your app: Bot → Add Bot
- Copy the Bot Token
Step 2: Enable Gateway Intents
Enable the intents Clawdbot needs:
- Message Content Intent — Required to read message content
- Server Members Intent — Required for allowlists or name lookups
Step 3: Generate Invite URL
Use the OAuth2 URL Generator in the Developer Portal:
Required permissions for Clawdbot Discord:
- Read Messages/View Channels
- Send Messages
- Embed Links
- Read Message History
- Add Reactions
- Use Slash Commands
Step 4: Configure Clawdbot Discord
Add your Discord bot to Clawdbot:
Environment variable:
DISCORD_BOT_TOKEN=YOUR_BOT_TOKENConfig file (~/.clawdbot/clawdbot.json):
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN"
}
}
}If both env and config are set, config takes precedence.
Step 5: Start the Gateway
clawdbot gateway --port 18789Discord auto-starts when a token is available and channels.discord.enabled is not false.
Step 6: Verify Connection
Check your Clawdbot Discord status:
clawdbot channels status discordHow It Works
- Direct chats collapse into the agent's main session (default
agent:main:main) - Guild channels stay isolated as
agent:<agentId>:discord:channel:<channelId> - Group DMs are ignored by default; enable via
channels.discord.dm.groupEnabled - Routing is deterministic: replies always go back to the channel they arrived on
Clawdbot Discord Features
DM Access Control
Direct chats are secure by default via channels.discord.dm.policy:
| Policy | Description |
|---|---|
pairing (default) | Unknown senders get a pairing code; approve via CLI |
allowlist | Only respond to users in dm.allowFrom list |
open | Respond to anyone (not recommended) |
disabled | Ignore all DMs |
Example (hard-allowlist):
{
"channels": {
"discord": {
"dm": {
"policy": "allowlist",
"allowFrom": ["user:123456789"]
}
}
}
}Guild Channel Configuration
Set per-guild or per-channel rules:
{
"channels": {
"discord": {
"guilds": {
"<guild_id>": {
"channels": ["bot-commands", "ai-chat"],
"requireMention": true
}
}
}
}
}Slash Commands
Clawdbot Discord supports native slash commands:
| Command | Clawdbot Discord Action |
|---|---|
/ask | Ask Clawdbot a question |
/help | Clawdbot Discord help menu |
/settings | Configure Clawdbot Discord |
/summarize | Clawdbot summarizes conversation |
Native commands default to "auto" (on for Discord/Telegram). Override with:
{
"channels": {
"discord": {
"commands": {
"native": true
}
}
}
}Guild Context History
Set channels.discord.historyLimit (default 20) to include the last N guild messages as context when replying to a mention. Set 0 to disable.
Reactions
The agent can trigger reactions via the discord tool (gated by channels.discord.actions.*).
Clawdbot Discord Configuration
Full Configuration Example
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"dm": {
"policy": "pairing",
"groupEnabled": false
},
"guilds": {
"*": {
"requireMention": true
}
},
"historyLimit": 20
}
}
}Config Writes
By default, Discord is allowed to write config updates triggered by /config set|unset. Disable with:
{
"channels": {
"discord": {
"configWrites": false
}
}
}Clawdbot Discord Credential Storage
Clawdbot stores Discord credentials securely:
~/.clawdbot/credentials/discord/bot_token
~/.clawdbot/credentials/discord/servers.jsonYour Clawdbot Discord data remains on your local machine.
Troubleshooting Clawdbot Discord
Bot Offline
If Clawdbot Discord appears offline:
- Verify token:
clawdbot channels verify discord - Check gateway connection
- Review logs:
cat /tmp/clawdbot/discord.log
Slash Commands Not Working
If Clawdbot Discord slash commands fail:
- Re-register commands via config
- Check bot permissions
- Verify server-specific command registration
Permission Errors
If Clawdbot Discord lacks permissions:
- Review bot role position in server settings
- Check channel-specific permissions
- Re-invite with correct permissions
Name Resolution
Name → id resolution uses guild member search and requires Server Members Intent. If the bot can't search members, use ids or <@id> mentions.
Clawdbot Discord Best Practices
- Use Pairing Mode: Secure by default with pairing codes for DMs
- Set Channel Limits: Restrict Clawdbot Discord to appropriate channels
- Configure Roles: Use role-based access for Clawdbot Discord
- Monitor Activity: Review Clawdbot Discord logs regularly
- Use Slash Commands: Better UX than text commands
Clawdbot Discord Use Cases
Community Support
Deploy Clawdbot Discord as a support bot:
- Answer FAQs automatically
- Escalate complex issues
- Provide 24/7 assistance
Gaming Communities
Use Clawdbot Discord for gaming servers:
- Game information lookup
- Team coordination
- Event scheduling
Developer Communities
Clawdbot Discord for developer servers:
- Code assistance
- Documentation lookup
- Bug triage
Next Steps
- Clawdbot WhatsApp Integration - Connect Clawdbot to WhatsApp
- Clawdbot Telegram Integration - Set up Clawdbot on Telegram
- Clawdbot Setup Guide - Complete installation guide