Discord

OpenClaw Discord channel plugin. Full bot integration with threads, reactions, and slash commands.

The Discord plugin connects OpenClaw to Discord's bot gateway, enabling your AI agent to operate as a fully-featured Discord bot with DM support, guild channel responses, thread awareness, reactions, slash commands, and file attachments. It uses the official Discord Gateway API for real-time bidirectional communication. Setup involves creating a Discord application in the Developer Portal, enabling privileged gateway intents (Message Content, Server Members), generating a bot token, and inviting the bot to your server with appropriate permissions. OpenClaw handles the connection lifecycle, message routing, and response delivery. The plugin supports pairing mode for DMs, server-wide or channel-specific allowlists, and multi-guild deployments. Discord is one of the most popular channels for self-hosted OpenClaw installations, particularly among developer and hobbyist communities. The thread support is especially useful — conversations in Discord threads map naturally to OpenClaw's session model, keeping context isolated per thread. Reactions, inline buttons, and slash commands provide interactive capabilities beyond plain text chat. Best suited for personal AI assistants in private servers, developer community bots, and team coordination channels. The detailed setup guide in OpenClaw docs walks through every step from bot creation to secure token configuration.

Tags: channel, messaging, community

Use Cases

  • Personal AI assistant in a private Discord server for daily task management, research, and automation
  • Developer community bot that answers technical questions using your documentation as context
  • Team coordination assistant in a project server — handles standup summaries, task tracking, and reminders
  • Content creation helper in a creator community — brainstorming, writing, and editing in dedicated channels
  • Multi-user AI playground where different users interact with the same agent in separate threads

Tips

  • Add the bot to a private personal server first for testing before deploying to shared servers
  • Use thread-based conversations for clean context isolation — each Discord thread maps to a separate OpenClaw session
  • Set bot token via environment variable DISCORD_BOT_TOKEN and reference it in config with source: env for security
  • Enable Server Members Intent if you want role-based allowlists or @mention name resolution
  • Use the pairing flow via DMs for initial setup — it's the smoothest onboarding path
  • If Discord is your first channel, use the CLI config method instead of asking your agent to set it up
  • Add Reactions permission for richer interaction — the bot can react to acknowledge messages

Known Issues & Gotchas

  • Never send your bot token in a Discord message or chat — use environment variables and the secure config ref system
  • You MUST enable Message Content Intent in the Developer Portal or the bot won't see message text
  • Developer Mode must be enabled in Discord settings to copy Server ID and User ID for configuration
  • DMs require 'Direct Messages' to be enabled in server Privacy Settings for pairing to work
  • Despite being called 'Reset Token', clicking it the first time actually generates your initial token — nothing is being reset
  • Global slash commands take up to 1 hour to propagate; guild-specific commands are instant
  • If running OpenClaw as a background service, use 'openclaw gateway restart' instead of starting a new instance after config changes
  • Bot permissions must include View Channels, Send Messages, Read Message History, Embed Links, and Attach Files at minimum

Alternatives

  • Telegram (built-in)
  • Matrix (@openclaw/matrix)
  • Slack (built-in)

Community Feedback

The install itself is fine, clone the repo, copy the example settings file, fill in your API key and telegram bot token, run the container.

— Reddit r/selfhosted

In this guide, we'll walk through self-hosting OpenClaw on your own machine and setting up Discord integration so you can interact with your AI agent.

— Pinggy Blog

OpenClaw is a game changer. With the Discord plugin I basically have a persistent AI assistant that lives in my server.

— Reddit r/openclaw

Quick setup: You will need to create a new application with a bot, add the bot to your server, and pair it to OpenClaw.

— OpenClaw Docs

Frequently Asked Questions

How do I create a Discord bot for OpenClaw?

Go to discord.com/developers, create a New Application, click Bot in the sidebar, set a username, enable Message Content Intent under Privileged Gateway Intents, generate a token, then create an OAuth2 invite URL with 'bot' and 'applications.commands' scopes. Invite the bot to your server using the generated URL.

Why isn't my Discord bot responding to messages?

The most common cause is not enabling the Message Content Intent in the Developer Portal. Without it, the bot can't read message text. Also verify the bot has View Channels and Read Message History permissions in your server.

Is my bot token secure in the OpenClaw config?

OpenClaw supports secure token storage via environment variables referenced in config. Set DISCORD_BOT_TOKEN as an env var and use source: env in your config. Never paste the raw token into a chat message or share it publicly.

Can I use Discord DMs with OpenClaw?

Yes. Enable Direct Messages in your server's Privacy Settings so the bot can DM you. DMs default to pairing mode, meaning the bot will verify your identity on first contact. You can also restrict DMs to specific user IDs.

Does the Discord plugin support threads?

Yes. Discord threads map naturally to OpenClaw sessions. Each thread maintains its own conversation context, which is ideal for multi-topic servers where different conversations need isolation.

Can multiple users interact with the bot in the same server?

Yes. The bot can respond in guild channels where multiple users participate. Use threads for per-user context isolation, or configure user allowlists to restrict who can interact with the bot.

How do I set up slash commands?

Slash commands are automatically registered when the bot starts with the applications.commands OAuth2 scope. Guild-specific commands appear instantly; global commands take up to 1 hour to propagate across Discord.

Configuration Examples

Minimal Discord Bot Setup

channels:
  discord:
    enabled: true
    token:
      source: env
      provider: default
      id: DISCORD_BOT_TOKEN

Discord with Guild and User Allowlists

channels:
  discord:
    enabled: true
    token:
      source: env
      provider: default
      id: DISCORD_BOT_TOKEN
    dm:
      policy: pairing
    guilds:
      allowed:
        - '111222333444555'
    users:
      allowed:
        - '666777888999000'

Discord Multi-Channel with Thread Support

channels:
  discord:
    enabled: true
    token:
      source: env
      provider: default
      id: DISCORD_BOT_TOKEN
    guilds:
      allowed:
        - '111222333444555'
    channelBehavior:
      threads: isolate
      mentionOnly: true

Installation

openclaw plugins install @openclaw/discord