๐Ÿ”—Integration & Channels

How to Add OpenClaw to Discord

Intermediate1-2 hoursUpdated 2025-01-14

Discord bots bring AI capabilities directly to your community server. This intermediate guide walks you through creating a Discord application, configuring bot permissions, setting up slash commands, and integrating OpenClaw so your server members can interact with AI without leaving Discord.

Why This Is Hard to Do Yourself

These are the common pitfalls that trip people up.

๐ŸŽฎ

Discord Developer Portal complexity

Creating a bot requires navigating application settings, bot users, OAuth2 URLs, and permission integers

โšก

Slash command registration

Discord slash commands need explicit registration with specific schemas, options, and permissions before they appear in the UI

๐Ÿ”

Intent configuration

Discord Gateway Intents control what events your bot receives. Wrong intents = missing messages.

๐Ÿงต

Thread and channel permissions

Bots need explicit permissions for threads, voice channels, and private channels. Default permissions often miss edge cases.

Step-by-Step Guide

Step 1

Create a Discord Application

# 1. Go to discord.com/developers/applications
# 2. Click "New Application"
# 3. Name: "OpenClaw AI"
# 4. Save the Application ID and Public Key
Step 2

Create a bot user

# Under Bot settings:
# 1. Click "Add Bot"
# 2. Reset Token and save it: MTk4NjIyNDgzNDcxOTI1MjQ4.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs
# 3. Enable Privileged Gateway Intents:
#    - SERVER MEMBERS INTENT
#    - MESSAGE CONTENT INTENT

Warning: The bot token is sensitive. Never commit it to version control or share it publicly.

Step 3

Configure OAuth2 and permissions

# Under OAuth2 โ†’ URL Generator:
# Scopes:
# - bot
# - applications.commands
#
# Bot Permissions (integer: 277025508416):
# - Read Messages/View Channels
# - Send Messages
# - Send Messages in Threads
# - Embed Links
# - Read Message History
# - Use Slash Commands
#
# Copy the generated URL and open it to add bot to your server
Step 4

Configure OpenClaw for Discord

# In config/channels/discord.yaml:
discord:
  enabled: true
  bot_token: "YOUR_BOT_TOKEN"
  application_id: "YOUR_APPLICATION_ID"
  public_key: "YOUR_PUBLIC_KEY"
  allowed_guilds: []  # Empty = all servers, or list server IDs
  prefix: "!"  # Text command prefix (optional)
Step 5

Register slash commands

# OpenClaw can auto-register commands on startup:
# In config/channels/discord.yaml (continued):
slash_commands:
  - name: "ask"
    description: "Ask OpenClaw a question"
    options:
      - name: "question"
        type: STRING
        description: "Your question"
        required: true
  - name: "summarize"
    description: "Summarize recent channel messages"
  - name: "help"
    description: "Show available commands"
Step 6

Test the integration

# In Discord, try:
# /ask question: What's the weather today?
# Or @OpenClaw AI in a channel
#
# Check OpenClaw logs:
tail -f ~/.openclaw/logs/channels.log | grep discord

Discord Bots Are More Complex Than They Look

Permissions, intents, slash command schemas, thread handling, voice channel support โ€” our Discord integration experts handle the entire setup so your community can start using OpenClaw immediately.

Get matched with a specialist who can help.

Sign Up for Expert Help โ†’

Frequently Asked Questions