Discord Bot API
Discord
Discord is a strong fit for teams, communities and channel-based collaboration. OpenClaw supports direct messages and server text channels, but you need to handle bot tokens, Message Content Intent, permissions and guild or channel rules correctly.
Quick Setup
1. Create an application and bot in the Discord Developer Portal, then copy the token.
2. Enable Message Content Intent. If you need member lookup or fine-grained allowlists, enable Server Members Intent too.
3. Invite the bot into the target server with the message permissions you need.
4. Pass the token through channels.discord.token or DISCORD_BOT_TOKEN.
Common Config Snippets
Minimal config
{
channels: {
discord: {
enabled: true,
token: "YOUR_BOT_TOKEN"
}
}
} Single guild, selected channels and users only
{
channels: {
discord: {
dm: { enabled: false },
guilds: {
YOUR_GUILD_ID: {
users: ["YOUR_USER_ID"],
requireMention: true,
channels: {
help: { allow: true, requireMention: true }
}
}
}
}
}
} Usage Notes
DM and channel sessions are separate
Direct messages collapse into the main conversation, while server channels stay isolated with keys like channel:<channelId>.
Do not let the bot read everything by default
Shared channels should usually keep requireMention so the bot is not triggered constantly by unrelated traffic.