openclaw/docs/channels/discord.md
2026-09-11 22:02:19 -07:00

15 KiB

summary read_when title
Discord bot setup, config keys, components, voice, and troubleshooting
Working on Discord channel features
Discord

OpenClaw connects to Discord as a bot over the official Discord gateway. DMs and guild channels are supported.

Discord DMs default to pairing mode. Native command behavior and command catalog. Cross-channel diagnostics and repair flow.

What each page covers

Where each section moved

Every section heading from the previous single-page version keeps its anchor here, so an existing link such as /channels/discord#voice-channels still resolves. Each entry points at the page that now holds the content.

Configuration reference

Primary reference: Configuration reference - Discord.

  • startup/auth: enabled, token, applicationId, accounts.*, allowBots
  • policy: groupPolicy, dmPolicy, allowFrom, dm.*, guilds.*, guilds.*.channels.*
  • group introductions: joinIntro, accounts.*.joinIntro (default: true)
  • command: commands.native, commands.allowFrom (global), configWrites, slashCommand.ephemeral
  • gateway: proxy
  • reply/history: replyToMode, historyLimit, dmHistoryLimit, dms.*.historyLimit
  • delivery: textChunkLimit (default 2000), maxLinesPerMessage (default 17)
  • streaming: streaming.mode, streaming.chunkMode, streaming.preview.*, streaming.progress.*, streaming.block.* (legacy flat streamMode, draftChunk, blockStreaming, blockStreamingCoalesce, chunkMode keys are migrated into streaming.* by openclaw doctor --fix)
  • media: mediaMaxMb (caps outbound Discord uploads, default 100)
  • actions: actions.*
  • presence: activity, status, activityType, activityUrl, autoPresence.*
  • features: threadBindings, top-level bindings[] (type: "acp"), pluralkit, execApprovals, intents, agentComponents.enabled, agentComponents.ttlMs, activities, heartbeatVisibility, responsePrefix

Discord Activities

Set channels.discord.activities to let the core show_widget tool post self-contained HTML widgets that open inside Discord. The block is opt-in. Discord registers the Activity plumbing statically, but the current-channel presenter stays unavailable and /discord/activity remains externally hidden behind the normal 404 until an enabled account has an available bot token, resolved client secret, and application ID. See Discord Activities for the Developer Portal, tunnel, security, and troubleshooting setup.

  • activities.clientSecret: OAuth2 client secret for the Discord application; falls back to DISCORD_CLIENT_SECRET
  • activities.applicationId: optional Activity application ID; defaults to the bot application ID learned at gateway startup

Safety and operations

  • Treat bot tokens as secrets (DISCORD_BOT_TOKEN preferred in supervised environments).
  • DISCORD_API_URL overrides the process-wide, versioned Discord REST base (for example, https://discord.example.com/api/v10). OpenClaw also uses that origin for Gateway discovery, WebSocket connections, media, webhooks, OAuth, and command registration; requests do not fall back to public Discord while the override is set. Plain HTTP/WS is accepted only on loopback, and Discord voice transport is unavailable with the override. Set it in the Gateway process environment or global runtime dotenv, not a workspace .env.
  • Grant least-privilege Discord permissions.
  • If command deploy/state is stale, restart the gateway and re-check with openclaw channels status --probe.
Launch interactive HTML widgets inside Discord. Pair a Discord user to the gateway. Emoji reaction semantics for the `message` tool. Group chat and allowlist behavior. Route inbound messages to agents. Threat model and hardening. Map guilds and channels to agents. Native command behavior.