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:

FeatureClawdbot Discord Benefit
Server IntegrationClawdbot Discord works across multiple servers
Slash CommandsNative Discord slash command support
DM + Guild SupportDirect chats share main session; guild channels stay isolated
Role-Based AccessControl Clawdbot Discord access by Discord roles
Deterministic RoutingReplies always go back to the channel they arrived on

Quick Setup (Beginner)

  1. Create a Discord bot and copy the bot token
  2. In the Discord app settings, enable Message Content Intent (and Server Members Intent if needed)
  3. Set the token via env (DISCORD_BOT_TOKEN=...) or config (channels.discord.token)
  4. Invite the bot to your server with message permissions
  5. Start the gateway
  6. 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:

  1. Go to Discord Developer Portal
  2. Click "New Application"
  3. In your app: Bot → Add Bot
  4. 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_TOKEN

Config 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 18789

Discord 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 discord

How 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:

PolicyDescription
pairing (default)Unknown senders get a pairing code; approve via CLI
allowlistOnly respond to users in dm.allowFrom list
openRespond to anyone (not recommended)
disabledIgnore 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:

CommandClawdbot Discord Action
/askAsk Clawdbot a question
/helpClawdbot Discord help menu
/settingsConfigure Clawdbot Discord
/summarizeClawdbot 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.json

Your Clawdbot Discord data remains on your local machine.

Troubleshooting Clawdbot Discord

Bot Offline

If Clawdbot Discord appears offline:

  1. Verify token: clawdbot channels verify discord
  2. Check gateway connection
  3. Review logs: cat /tmp/clawdbot/discord.log

Slash Commands Not Working

If Clawdbot Discord slash commands fail:

  1. Re-register commands via config
  2. Check bot permissions
  3. Verify server-specific command registration

Permission Errors

If Clawdbot Discord lacks permissions:

  1. Review bot role position in server settings
  2. Check channel-specific permissions
  3. 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

  1. Use Pairing Mode: Secure by default with pairing codes for DMs
  2. Set Channel Limits: Restrict Clawdbot Discord to appropriate channels
  3. Configure Roles: Use role-based access for Clawdbot Discord
  4. Monitor Activity: Review Clawdbot Discord logs regularly
  5. 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