# Discord (Bot API) ## Overview OpenClaw supports Discord integration for direct messages and guild text channels. The system requires a bot token, message content intent, and proper configuration to function. ## Quick Setup To enable Discord: 1. Create a Discord bot application and obtain the token 2. Enable "Message Content Intent" and "Server Members Intent" in Discord Developer Portal 3. Configure the token via environment variable (`DISCORD_BOT_TOKEN`) or config file 4. Invite the bot to your server with appropriate permissions 5. Start the gateway **Minimal configuration:** ```json { "channels": { "discord": { "enabled": true, "token": "YOUR_BOT_TOKEN" } } } ``` ## Key Features - **DM handling**: Uses pairing-based security by default; unknown senders receive time-limited pairing codes - **Guild channels**: Isolated sessions per channel with optional mention requirements - **Group DMs**: Disabled by default; can be enabled via configuration - **Message routing**: Replies always return to the originating channel - **File uploads**: Supported up to 8 MB (configurable) - **Reactions**: Available via the `discord` tool when enabled ## Configuration Options The system supports granular control through: - Per-guild rules and channel-specific settings - User allowlists at multiple levels (DM, guild, channel) - Mention requirements for reducing noise in shared channels - Tool action gates (reactions, threads, moderation, etc.) - Reply threading via special tags in model output ## Safety Considerations - Treat bot tokens as sensitive credentials; use environment variables in production - Grant only necessary permissions (View Channels, Send Messages, Read History) - Use allowlists to restrict access in shared spaces - Monitor rate limiting with retry policies