Skip to content

How to Connect OpenClaw to Discord

nacre.sh TeamMay 3, 20268 min read

Connect OpenClaw to Discord as a bot. Complete guide covering Discord Developer Portal setup, bot permissions, OAuth2, and slash command configuration.

openclaw discord setupopenclaw discord botopenclaw channelsdiscord ai agent

OpenClaw Discord setup is one of the most popular channel configurations among developers and community builders. Running your OpenClaw agent as a Discord bot lets you interact with it in your personal servers, share it with friends or teammates, and use Discord's rich formatting for responses. Here's the complete setup guide.

Step 1: Create a Discord Application

  1. Visit the Discord Developer Portal (discord.com/developers)
  2. Click New Application and give it a name
  3. Navigate to Bot in the left sidebar
  4. Click Add Bot
  5. Under Token, click Reset Token and copy the bot token (this is your Discord bot token)
  6. Enable these Privileged Gateway Intents: Message Content Intent, Server Members Intent

Step 2: Set Bot Permissions

Navigate to OAuth2 → URL Generator. Select:

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

Copy the generated URL and open it in your browser to add the bot to your Discord server.

Step 3: Configure OpenClaw

Add to ~/.openclaw/openclaw.json:

{
  "channels": {
    "discord": {
      "enabled": true,
      "token": "YOUR_DISCORD_BOT_TOKEN",
      "allowed_channels": [],
      "command_prefix": "!",
      "slash_commands": true
    }
  }
}

Setting allowed_channels to an empty list allows all channels. To restrict to specific channels, add their IDs: "allowed_channels": ["1234567890123456789"].

Step 4: Start OpenClaw and Test

python -m openclaw start

In your Discord server, try:

  • !ask What is the weather like today? (prefix command)
  • /ask What is the weather like today? (slash command, if enabled)
  • Or simply @mention your bot

Formatting in Discord

OpenClaw supports Discord's markdown formatting in responses:

  • **bold** for emphasis
  • ```code blocks``` for code
  • > quotes for references

Enable Discord formatting mode in your config: "format": "discord_markdown".

Running in Multiple Servers

One OpenClaw instance can operate in multiple Discord servers simultaneously. Add the bot to each server using the OAuth2 URL. Conversations in each server maintain separate context by default.

Frequently Asked Questions

How do I restrict my bot to specific Discord channels?

Copy the channel ID (right-click channel → Copy Channel ID with Developer Mode on) and add it to allowed_channels in your config.

Can multiple Discord users interact with the same OpenClaw agent?

Yes. Each user's conversation is tracked separately by default using their Discord user ID. Users don't see each other's conversations.

Does OpenClaw support Discord voice channels?

Not in the current release. Text-based interaction only. Community skill requests for voice integration exist on the OpenClaw GitHub roadmap.

nacre.sh

Run OpenClaw without the server headaches

Dedicated instance, automatic TLS, nightly backups, and 290+ LLM integrations. Live in under 90 seconds from $12/month.

Deploy your agent →

Related posts