Discord Bot Setup

Run your OpenClaw agent in Discord servers and DMs.

10 min read Updated Feb 2026

Overview

OpenClaw uses discord.js for the Discord Bot API + Gateway. It supports servers, channels, DMs, threads, reactions, and media.

Step 1: Create a Discord Application

  • Go to Discord Developer Portal
  • Click "New Application" and give it a name
  • Go to the "Bot" section and click "Add Bot"
  • Copy the bot token
  • Enable "Message Content Intent" under Privileged Gateway Intents

Step 2: Invite the Bot

Generate an invite URL from the OAuth2 section with these permissions:

  • Send Messages
  • Read Message History
  • Add Reactions
  • Attach Files
  • Use Slash Commands (optional)

Step 3: Configure OpenClaw

openclaw.json
{
  "channels": {
    "discord": {
      "botToken": "YOUR_DISCORD_BOT_TOKEN",
      "dm": {
        "policy": "pairing",
        "allowFrom": []
      }
    }
  }
}

Step 4: Restart and Test

openclaw gateway restart

Your bot should appear online in Discord. Send it a DM or mention it in a server channel.

Server Configuration

In servers, the bot responds when mentioned. Configure mention patterns:

openclaw.json
{
  "messages": {
    "groupChat": {
      "mentionPatterns": ["@YourBotName"]
    }
  }
}

What's Next?