Quick Start in 3 Steps

Step 1 — Create a Discord bot app at discord.com/developers and copy the bot token.

Step 2 — Configure OpenClaw:

openclaw config set discord.bot_token "YOUR_BOT_TOKEN"
openclaw config set discord.allowed_roles "admin,ai-users"

Step 3 — Start and test:

openclaw start --discord
# Then in Discord: /run Summarize this week's commits

Prerequisites

  • OpenClaw v1.0.0 or later installed (Installation Guide)
  • A Discord account with server management permissions
  • Access to Discord Developer Portal
  • Your Discord server with at least one channel to assign to the bot

Step 1: Create a Discord Application

  1. Go to discord.com/developers/applications
  2. Click New Application and give it a name
  3. Navigate to Bot → click Add Bot
  4. Copy the Bot Token (keep this secret!)
  5. Under Privileged Gateway Intents, enable Message Content Intent
⚠️
Token Security

Never commit your Discord bot token to version control. Store it using DISCORD_BOT_TOKEN environment variable or the OpenClaw config.

Step 2: Invite Bot to Your Server

Generate an invite URL in the OAuth2 → URL Generator tab:

  • Scopes: bot, applications.commands
  • Permissions: Send Messages, Read Message History, Use Slash Commands

Open the generated URL and add the bot to your server.

Step 3: Install the Discord Pack

openclaw install discord

Step 4: Configure

openclaw config set discord.bot_token "YOUR_BOT_TOKEN"
openclaw config set discord.allowed_roles "admin,ai-users"
openclaw config set discord.command_prefix "/"
# config.yaml
integrations:
  discord:
    bot_token: "${DISCORD_BOT_TOKEN}"
    guild_id: "YOUR_SERVER_ID"       # optional: restrict to one server
    allowed_roles:
      - admin
      - ai-users
    command_channel: "ai-commands"   # only respond in this channel

Slash Commands

CommandDescription
/run <task>Execute an AI task
/statusShow current job and agent status
/stopStop the running task
/provider <name>Switch AI provider (openai/claude/ollama)
/helpShow available commands

Step 5: Start

openclaw start --discord

Type /run Summarize today's AI news in your Discord server to test.

Channel Permissions

To restrict bot activity to specific channels:

  • Set command_channel to the channel name in config
  • Use Discord's channel permission overrides to deny the bot access to other channels
  • Use allowed_roles to limit who can invoke commands

Automated Channel Reports

Schedule OpenClaw to post periodic AI-generated reports to a specific Discord channel:

# config.yaml
integrations:
  discord:
    bot_token: "${DISCORD_BOT_TOKEN}"
    guild_id: "YOUR_SERVER_ID"
    allowed_roles:
      - admin
      - ai-users
    scheduled_reports:
      - cron: "0 9 * * 1"          # Every Monday at 9 AM
        channel: "weekly-digest"
        task: "Generate a weekly AI technology summary"
      - cron: "0 18 * * *"         # Daily at 6 PM
        channel: "dev-updates"
        task: "Summarize today's GitHub commits and open issues"

Common Use Cases for Teams

  • #ai-commands channel — dedicated channel for team members to run AI tasks
  • Code review bot — paste code in a thread, ask /run Review this Python snippet
  • Daily standup summary — schedule a morning digest post in #general
  • CI/CD notifications — send deployment results from GitHub Actions to Discord via OpenClaw
  • Research assistant — team members share articles with /run Summarize this: [URL]

Role-Based Access Control

Restrict which Discord roles can use specific bot commands:

integrations:
  discord:
    permissions:
      admin:
        commands: [run, stop, config, status]
      ai-users:
        commands: [run, status, help]
      viewer:
        commands: [status, help]
📋
Best Practice: Create a dedicated ai-users role in Discord and assign it only to trusted team members to prevent unauthorized AI usage.

Security Best Practices

  • Store the bot token in an environment variable: DISCORD_BOT_TOKEN
  • Restrict the bot to specific channels using command_channel config
  • Enable Message Content Intent only — do not enable unnecessary privileged intents
  • Regularly audit which server members have the ai-users role
  • Use guild_id to restrict the bot to a single server (no public bot)

Troubleshooting

ProblemCauseFix
Bot is offline in DiscordOpenClaw isn't runningRun openclaw start --discord
Slash commands not showingMissing applications.commands scopeRe-invite bot with correct OAuth2 scopes
"Missing Access" errorBot missing channel permissionsIn Discord, assign bot role with "Send Messages" and "Use Slash Commands" in the target channel
Bot ignores commandsUser role not in allowed_rolesAdd the role to discord.allowed_roles in config
Token Invalid errorToken was reset or revokedRegenerate token in Developer Portal → Bot

Try It Yourself

Once your bot is running and invited to your server, test these slash commands in your designated AI channel.

Example 1: Ask the bot to summarise a block of text

# In Discord, type:
/openclaw run Summarise this in 3 bullets: [paste article text here]

# Bot replies in the same channel within seconds:
# 🤖 OpenClaw:
# • New OpenAI model supports 1M token context
# • Price cut of 50% on GPT-4o-mini announced
# • API rate limits doubled for paid tier users

Example 2: Daily digest posted to a channel

# Run on your server via cron, posts to #dev-reports channel
0 9 * * 1-5 openclaw run "Create a developer morning digest: new GitHub issues overnight, recent PRs, and deploy status" \
  --path ~/projects/ \
  | openclaw discord send --channel dev-reports

Example 3: Code review bot for a team channel

# In Discord #code-review channel:
/openclaw run Review this Python function for bugs, and suggest a more Pythonic rewrite:

def get_items(list):
    result = []
    for i in range(len(list)):
        result.append(list[i])
    return result

# Bot replies with analysis and improved version:
# Bug: overwrites built-in 'list'
# Pythonic version: def get_items(items: list) -> list: return list(items)
Channel setup tip: Create a dedicated #ai-bot channel and set command_channel: "ai-bot" in your config. This keeps AI task output separate from general chat and makes it easy to audit what the bot has run.

What's Next