加入我们的 Telegram 社群 (clawdbotCN) 学习分享和了解更多 →
en
Channels
Discord

Discord Configuration

Integrates with Discord through the discord.js library, supporting server channels and direct messages.

Quick Start

1. Create a Bot

  1. Visit Discord Developer Portal (opens in a new tab)
  2. Create a new application
  3. Go to Bot page, create Bot and copy Token

2. Enable Intents

Enable in Developer Portal:

  • Message Content Intent (required)
  • Server Members Intent (recommended)

3. Configure

{
  channels: {
    discord: {
      enabled: true,
      token: "YOUR_BOT_TOKEN"
    }
  }
}

4. Generate Invite Link

Set permissions and invite Bot to server:

  • View Channels
  • Send Messages
  • Read Message History
  • Embed Links (optional)
  • Attach Files (optional)
  • Add Reactions (optional)

Access Control

DM Security

Uses pairing mode by default:

{
  channels: {
    discord: {
      dmPolicy: "pairing"
    }
  }
}

Channel Configuration

Use requireMention in shared channels to prevent unwanted activations:

{
  channels: {
    discord: {
      groups: {
        "*": {
          requireMention: true
        }
      }
    }
  }
}

Channel Allowlist

Only respond in specified channels:

{
  channels: {
    discord: {
      channelAllowlist: [
        "123456789",  // Channel ID
        "987654321"
      ]
    }
  }
}

Full Configuration

{
  channels: {
    discord: {
      enabled: true,
      token: "YOUR_BOT_TOKEN",
 
      dmPolicy: "pairing",
      groupPolicy: "open",
 
      textChunkLimit: 2000,
 
      groups: {
        "*": {
          requireMention: true
        }
      }
    }
  }
}

Troubleshooting

Bot Connects but Doesn't Reply

  • Confirm Message Content Intent is enabled
  • Check Bot has correct channel permissions

Diagnostic Command

clawdbot doctor

Next Steps