Skip to main content
HowOpenClaw

Discord

Connect your self-hosted AI assistant to Discord. Create a bot, set permissions, invite it to your server, and start chatting — step-by-step guide.

Discord works well for community-facing use cases and casual personal use. The setup requires creating a bot application in Discord's Developer Portal — slightly more involved than Telegram, but well-documented. Discord runs on any supported OpenClaw host, and costs only your AI provider's API fees — there's no Discord subscription or per-server charge.

New to OpenClaw? The installation guide covers getting the gateway running first. If you want to validate the setup with a simpler channel, try Telegram — it takes about 2 minutes — then come back here.

Create your Discord bot

  1. Go to discord.com/developers/applications
  2. Click New Application and give it a name
  3. Go to the Bot tab → click Add Bot
  4. Under Privileged Gateway Intents, enable Message Content Intent (required to read messages)
  5. Copy the bot token

Invite the bot to your server

  1. Go to OAuth2 → URL Generator
  2. Scopes: bot, applications.commands
  3. Bot Permissions: Send Messages, Read Message History, Use Slash Commands
  4. Open the generated URL to invite the bot to your server

Save your token as an environment variable:

export DISCORD_BOT_TOKEN="your-bot-token-here"

Find your server and channel IDs

Enable Developer Mode in Discord settings (Appearance → Advanced → Developer Mode), then right-click any server or channel to copy its ID.

Configure OpenClaw

Add the Discord channel to ~/.openclaw/openclaw.json:

{
  "channels": {
    "discord": {
      "enabled": true,
      "dmPolicy": "pairing",
      "groupPolicy": "mention",
      "requireMention": true,
      "botToken": "${DISCORD_BOT_TOKEN}",
      "allowedGuilds": [
        "123456789012345678"
      ],
      "allowedChannels": [
        "987654321098765432"
      ]
    }
  }
}

Restart and test

openclaw gateway restart
openclaw logs --filter discord

@mention your bot in an allowed channel:

@YourBot are you there?

Auto Threads

When threadReplies: true is enabled, OpenClaw auto-creates threads for new conversations. By default, thread names are based on the triggering message content.

You can set autoThreadName: "generated" to have threads renamed asynchronously with concise LLM-generated titles:

{
  "channels": {
    "discord": {
      "threadReplies": true,
      "autoThreadName": "generated"
    }
  }
}

When set to "generated", the thread is created immediately (so replies aren't delayed) and then renamed in the background once the LLM produces a short title. The default message-based naming remains if you omit this setting.

Stability Considerations

Discord's WebSocket gateway can experience crashes, zombie connections, and rate limiting during high traffic. A zombie connection is when the bot appears online but isn't receiving events — the worst kind of failure because it's silent.

OpenClaw centralizes Discord gateway error handling behind a lifetime-owned supervisor, so early, active, and late-teardown errors are classified consistently and no longer surface as process-killing crashes.

Enable reconnection logic in your config:

{
  "reconnect": {
    "enabled": true,
    "maxRetries": 10,
    "retryDelay": 5000,
    "heartbeatInterval": 30000
  }
}

This automatically detects and recovers from dropped connections.

Timeouts (v2026.4.12)

If the inbound Discord worker times out before a final reply starts, OpenClaw now sends a visible timeout reply to the user — including in auto-created threads and queued runs. Previously, timeouts could result in silent failures with no feedback in the channel.

Media Handling (v2026.4.12)

  • Media cap raised to 100MB (previously 25MB), bringing Discord closer to Telegram's limits for large video and audio attachments
  • Generated images are now properly tracked with real MEDIA: paths instead of missing local files
  • Component-only media sends are preserved without extra plain-output requeueing
  • Text-plus-video deliveries are intelligently split into a text reply followed by a media-only send, ensuring video attachments render properly

Tool-Call Text Handling (v2026.4.15)

New in v2026.4.15

Standalone Gemma-style <function>...</function> tool-call payloads are now stripped from visible assistant text in Discord. This prevents raw tool-call XML from appearing in your Discord channel when using models that emit that format (such as Gemma). Prose examples that mention <function> tags and trailing replies after tool calls are preserved correctly — only the actual standalone tool-call payloads are removed.

Voice Sessions (v2026.5.20)

New in v2026.5.20

Voice sessions can now follow configured Discord users into voice channels, with allowed-channel checks, multi-user handoff, bounded reconciliation, and DAVE recovery preservation. Realtime voice instructions also bootstrap with bounded IDENTITY.md, USER.md, and SOUL.md profile context by default — so your agent speaks with the same personality and user awareness it uses elsewhere.

Voice user-following is opt-in per Discord account. Once configured, the bot joins the voice channel a tracked user enters (within the allowedChannels list), hands off cleanly between users, and recovers DAVE end-to-end encryption state across reconnects.

To disable profile context in voice instructions — useful for a privacy-conscious voice agent, or to reduce voice latency on slow networks — set:

{
  "voice": {
    "realtime": {
      "bootstrapContextFiles": []
    }
  }
}

The default includes IDENTITY.md, USER.md, and SOUL.md (bounded to keep voice latency low). Empty array opts out entirely.

Discord voice is also the first live source for transcript capture — your agent can auto-capture conversations from voice sessions and surface them via openclaw transcripts. This started as the Meeting Notes plugin in v2026.5.22 and became OpenClaw's core transcripts tool in v2026.5.26. See the CLI reference for details.


Component Callback Lifetime (v2026.5.22)

New in v2026.5.22

For long-running component workflows (buttons, selects, modals that may not be clicked for hours), you can now configure a bounded agentComponents.ttlMs callback registry lifetime — with per-account overrides and a hard 24-hour cap. This prevents component callbacks from being garbage-collected before a user gets back to clicking them.

{
  "channels": {
    "discord": {
      "agentComponents": {
        "ttlMs": 3600000
      }
    }
  }
}

The default is short-lived (suitable for ephemeral confirmations). Raise it when your bot posts components that users may not interact with immediately — approval workflows, polls, long-running task UIs.


Model Picker for Large Catalogs (v2026.5.26)

If you run Discord with a wide model catalog (for example a provider/* wildcard), the in-channel model picker no longer makes you paginate through prev/next pages. When a provider list — or a single provider's model list — exceeds 25 items, the picker shows an alpha-bucket select so the right model is one click away:

A–G (12) · H–N (18) · O–Z (5)

It falls back to numeric chunks when every item shares the same first letter. Live Discord runs also surface useful in-progress context in progress drafts as of v2026.5.28, so you can see what the agent is doing mid-run instead of waiting for the final reply.


Slash Command Access Policy (v2026.4.23)

Security fix in v2026.4.23

Native slash-command channel policy no longer bypasses configured owner or member restrictions. Previously, a permissive channel policy could unintentionally override owner or member allowlists for native slash commands; now the stricter access rule wins. Channel-policy fallback still applies when no stricter rule exists, so legitimate allowlist setups are unaffected. (#70711) Thanks @vincentkoc.

Reply routing preserved (v2026.4.23)

Final-reply permission context is now carried through outbound delivery, so Discord replies keep the same channel and member routing rules at send time that applied when the reply was generated.

Recent Fixes (v2026.4.12)

  • Media cap raised to 100MB — supports larger generated videos and audio files
  • Generated images properly tracked with real file paths
  • Component-only media sends no longer produce duplicate plain text
  • Text-plus-video deliveries split correctly so both arrive
  • REST, webhook, and monitor traffic stays on the configured proxy
  • @everyone and @here mention gates are honored
  • ACK reactions stay on the active account
  • Voice connect/playback timeouts are split so auto-join is more reliable
  • Reply tags no longer leak control metadata like [[reply_to_current]] into preview text
  • Explicit reply-tag threading is honored during final delivery
  • Reply-to-batched delivery uses correct replyToMode: "batched" instead of legacy flags
  • Visible timeout replies sent when worker times out before final reply starts
  • Numeric Discord server and channel IDs in config are now auto-coerced to strings — no more startup failures if you paste a raw number into allowedGuilds or allowedChannels
  • Auto-thread names now work correctly with reasoning models (enough output budget for thinking + title text)
  • Telegram — simpler setup, better for personal 1:1 use
  • Slack — better for work teams with existing Slack workspaces

Evaluating OpenClaw against other AI tools? See OpenClaw vs ChatGPT — Discord integration is one of the things ChatGPT simply doesn't offer.


Security Recommendations

Never grant Administrator permissions. Your bot only needs to read and send messages in specific channels.

Restrict to allowedChannels. Don't let the bot operate in every channel — create a dedicated #assistant channel.

Use threads. Configure threadReplies: true to keep conversations organized and reduce rate-limiting risk.

Avoid public servers. If your bot is in a public server, use allowedGuilds to restrict it to servers you control.

Rate Limiting

Discord enforces rate limits on bots. If you're sending many messages quickly (e.g., from an automation), you may hit these limits.

To avoid rate limiting:

  • Use threadReplies: true — threads have more permissive limits than main channels
  • Add response delays for automated messages
  • Don't use Discord for high-frequency automations — use Slack or iMessage instead

Something not working?

Check the troubleshooting guide for common issues with gateway startup, channel connections, and automations.

FAQ

Does the Discord bot need admin permissions in my server?
No. The bot only needs the minimum permissions for its function: Send Messages, Read Message History, and View Channels in the channels you want it active in. Never grant Administrator permissions to a bot — limit it to exactly what it needs. You set permissions during the OAuth2 invite step in the Discord Developer Portal.
Can the bot respond in multiple Discord servers?
Yes. Invite the bot to as many servers as you like. In openclaw.json, configure each guild ID and which channels the bot should monitor in each. The same bot token works across all servers — you don't need separate bots.
Is Discord free to use with OpenClaw?
Yes. Discord's free tier is sufficient for running an OpenClaw bot. You don't need Discord Nitro or any paid plan. The Discord Developer Portal, bot creation, and all required API features are free. Your only costs are the AI provider API calls that generate responses.