๐ŸŽฎ Discord Bot Setup

Add your OpenClaw to Discord servers

Discord vs Telegram

Discord setup is slightly more involved than Telegram, but gives you more features like slash commands, reactions, and server integrations. Great if you live in Discord or want to add OpenClaw to a community server.

1

Create a Discord Application

  1. Go to the Discord Developer Portal
  2. Click "New Application"
  3. Name it (e.g., "My OpenClaw") and click Create
  4. You're now in your application's settings
2

Create a Bot User

  1. In the left sidebar, click "Bot"
  2. Click "Add Bot" โ†’ "Yes, do it!"
  3. Under the bot's username, click "Reset Token"
  4. Copy the token โ€” you'll need this for OpenClaw

โš ๏ธ Keep Your Token Secret

Never share your bot token. Anyone with it can control your bot. If it leaks, immediately reset it in the Developer Portal.

3

Configure Bot Settings

On the Bot page, configure these settings:

โš ๏ธ Message Content Intent Required

Without "Message Content Intent" enabled, your bot cannot read message text. This is the most common setup mistake!

4

Generate an Invite Link

  1. Go to "OAuth2" โ†’ "URL Generator"
  2. Under Scopes, select: bot and applications.commands
  3. Under Bot Permissions, select the permissions below
  4. Copy the generated URL at the bottom

Recommended Permissions

Send Messages
Read Message History
View Channels
Add Reactions
Embed Links
Attach Files
Use Slash Commands
Manage Messages
5

Invite the Bot to Your Server

  1. Open the invite URL you generated
  2. Select the server you want to add it to
  3. Authorize the requested permissions
  4. Complete any CAPTCHA if prompted

Your bot should now appear offline in your server's member list.

6

Get Your Discord User ID

To restrict who can use the bot:

  1. Enable Developer Mode: User Settings โ†’ App Settings โ†’ Advanced โ†’ Developer Mode
  2. Right-click your username anywhere in Discord
  3. Click "Copy User ID"
# Your ID will look like:
123456789012345678
7

Configure OpenClaw

# Add to ~/.openclaw/config.yaml:

channels:
  discord:
    token: "YOUR_BOT_TOKEN"
    allowedUsers:
      - "123456789012345678"  # Your Discord user ID

Or via CLI:

openclaw channels add discord \
  --token "YOUR_BOT_TOKEN" \
  --allowed-users "123456789012345678"
8

Start OpenClaw

openclaw gateway

# Your bot should come online in Discord!

๐ŸŽ‰ Done!

Your bot is now online. DM it or mention it in a channel to start chatting!

Interaction Modes

DM Mode (Default)

By default, the bot responds to direct messages from allowed users. Just DM it like you would a friend.

Channel Mode (Mentions)

In server channels, the bot responds when @mentioned:

@MyOpenClaw what's the weather like today?

Prefix Mode

Configure a command prefix so the bot responds to messages starting with it:

channels:
  discord:
    token: "..."
    prefix: "!"  # Bot responds to !command
    
# Usage:
!what's the weather today?

Troubleshooting

Bot doesn't respond?

Bot is offline?

"Privileged Intents" error?

You need to enable the Message Content Intent in the Discord Developer Portal under Bot settings. This is required for bots in 100+ servers, but good practice to enable for all bots.

Related Guides

Next up: WhatsApp setup

Prefer WhatsApp? Link your account and chat anywhere.

Continue to WhatsApp โ†’ Join Discord

Stay in the loop

The 5-minute weekly read that makes your OpenClaw smarter.