Discord
Ready for DM and guild text channels via the official Discord bot gateway
Status: ready for DM and guild text channels via the official Discord bot gateway.
Quick setup (beginner)
- Create a Discord bot and copy the bot token.
- Set the token:
- Env:
DISCORD_BOT_TOKEN=... - Or config:
channels.discord.token: "..."
- Env:
- 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"
}
}
}How to create your own bot
1) Create the Discord app + bot user
- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to "Bot" tab and click "Add Bot"
- Copy the bot token (keep it secret!)
2) Enable the gateway intents Clawdbot needs
In the Bot settings, enable:
- Message Content Intent - required to read message content
- Server Members Intent - required for name resolution
3) Generate an invite URL (OAuth2 URL Generator)
Go to OAuth2 → URL Generator:
- Scopes:
bot,applications.commands - Bot Permissions: Read Messages, Send Messages, Read Message History, Add Reactions
4) Get the IDs (guild/user/channel)
Enable Developer Mode in Discord (Settings → Advanced → Developer Mode), then right-click to copy IDs.
Configure Clawdbot
{
"channels": {
"discord": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"dm": {
"policy": "pairing",
"allowFrom": []
},
"guilds": {
"YOUR_GUILD_ID": {
"channels": {
"CHANNEL_ID": {
"requireMention": true
}
}
}
}
}
}
}Session routing
- Direct chats: collapse into the agent's main session
- Guild channels: stay isolated as
agent:<agentId>:discord:channel:<channelId> - Group DMs: ignored by default; enable via
channels.discord.dm.groupEnabled
Capabilities & limits
- Text messages: Full support
- Embeds: Rich embeds supported
- Reactions: Via the
discordtool (gated by config) - Slash commands: Native command registration
- History limit: Configurable via
channels.discord.historyLimit(default 20)
Retry policy
Failed messages are retried with exponential backoff.
Access control
DM access
dm.policy: "pairing"(default) - unknown senders get a pairing codedm.policy: "open"+dm.allowFrom: ["*"]- open to anyonedm.policy: "allowlist"- hard allowlist onlydm.enabled: false- ignore all DMs
Approve pairing: clawdbot pairing approve discord <code>
Guild rules
Set per-guild and per-channel rules with channels.discord.guilds.
Troubleshooting
- Bot not responding in guilds: Check Message Content Intent is enabled
- Bot not seeing messages: Ensure bot has Read Messages permission in channel
- Pairing not working: Check
clawdbot pairing list discord - Name resolution failing: Enable Server Members Intent
Note: Slugs are lowercase with spaces replaced by -. Channel names are slugged without the leading #.