Ready for DMs and guild channels via the official Discord gateway.Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
Pairing
Slash commands
Channel troubleshooting
Quick setup
You will need to create a new application with a bot, add the bot to your server, and pair it to OpenClaw. We recommend adding your bot to your own private server. If you don’t have one yet, create one first (choose Create My Own > For me and my friends).Create a Discord application and bot
Enable privileged intents
- Message Content Intent (required)
- Server Members Intent (recommended; required for role allowlists and name-to-ID matching)
- Presence Intent (optional; only needed for presence updates)
Copy your bot token
Generate an invite URL and add the bot to your server
botapplications.commands
- View Channels Text Permissions
- Send Messages
- Read Message History
- Embed Links
- Attach Files
- Add Reactions (optional)
Enable Developer Mode and collect your IDs
- Click User Settings (gear icon next to your avatar) → Advanced → toggle on Developer Mode
- Right-click your server icon in the sidebar → Copy Server ID
- Right-click your own avatar → Copy User ID
Allow DMs from server members
Set your bot token securely (do not send it in chat)
openclaw gateway run process.
For managed service installs, run openclaw gateway install from a shell where DISCORD_BOT_TOKEN is present, or store the variable in ~/.openclaw/.env, so the service can resolve the env SecretRef after restart.
If your host is blocked or rate-limited by Discord’s startup application lookup, set the Discord application/client ID from the Developer Portal so startup can skip that REST call. Use channels.discord.applicationId for the default account, or channels.discord.accounts.<accountId>.applicationId when you run multiple Discord bots.Configure OpenClaw and pair
- Ask your agent
- CLI / config
“I already set my Discord bot token in config. Please finish Discord setup with User ID<user_id>and Server ID<server_id>.”
Approve first DM pairing
- Ask your agent
- CLI
“Approve this Discord pairing code: <CODE>”
DISCORD_BOT_TOKEN is only used for the default account.
If two enabled Discord accounts resolve to the same bot token, OpenClaw starts only one gateway monitor for that token. A config-sourced token wins over the default env fallback; otherwise the first enabled account wins and the duplicate account is reported disabled.
For advanced outbound calls (message tool/channel actions), an explicit per-call token is used for that call. This applies to send and read/probe-style actions (for example read/search/fetch/thread/pins/permissions). Account policy/retry settings still come from the selected account in the active runtime snapshot.Recommended: Set up a guild workspace
Once DMs are working, you can set up your Discord server as a full workspace where each channel gets its own agent session with its own context. This is recommended for private servers where it’s just you and your bot.Add your server to the guild allowlist
- Ask your agent
- Config
“Add my Discord Server ID <server_id> to the guild allowlist”
Allow responses without @mention
message tool, so the agent can lurk by default and only post when it decides a channel reply is useful.This means the selected model must reliably call tools. If Discord shows typing and the logs show token usage but no posted message, check the session log for assistant text with didSendViaMessagingTool: false. That means the model produced a private final answer instead of calling message(action=send). Switch to a stronger tool-calling model, or use the config below to restore legacy automatic final replies.- Ask your agent
- Config
“Allow my agent to respond on this server without having to be @mentioned”
#coding, #home, #research, or whatever fits your workflow.
Runtime model
- Gateway owns the Discord connection.
- Reply routing is deterministic: Discord inbound replies back to Discord.
- Discord guild/channel metadata is added to the model prompt as untrusted context, not as a user-visible reply prefix. If a model copies that envelope back, OpenClaw strips the copied metadata from outbound replies and from future replay context.
- By default (
session.dmScope=main), direct chats share the agent main session (agent:main:main). - Guild channels are isolated session keys (
agent:<agentId>:discord:channel:<channelId>). - Group DMs are ignored by default (
channels.discord.dm.groupEnabled=false). - Native slash commands run in isolated command sessions (
agent:<agentId>:discord:slash:<userId>), while still carryingCommandTargetSessionKeyto the routed conversation session. - Text-only cron/heartbeat announce delivery to Discord uses the final assistant-visible answer once. Media and structured component payloads remain multi-message when the agent emits multiple deliverable payloads.
Forum channels
Discord forum and media channels only accept thread posts. OpenClaw supports two ways to create them:- Send a message to the forum parent (
channel:<forumId>) to auto-create a thread. The thread title uses the first non-empty line of your message. - Use
openclaw message thread createto create a thread directly. Do not pass--message-idfor forum channels.
channel:<threadId>).
Interactive components
OpenClaw supports Discord components v2 containers for agent messages. Use the message tool with acomponents payload. Interaction results are routed back to the agent as normal inbound messages and follow the existing Discord replyToMode settings.
Supported blocks:
text,section,separator,actions,media-gallery,file- Action rows allow up to 5 buttons or a single select menu
- Select types:
string,user,role,mentionable,channel
components.reusable=true to allow buttons, selects, and forms to be used multiple times until they expire.
To restrict who can click a button, set allowedUsers on that button (Discord user IDs, tags, or *). When configured, unmatched users receive an ephemeral denial.
The /model and /models slash commands open an interactive model picker with provider, model, and compatible runtime dropdowns plus a Submit step. /models add is deprecated and now returns a deprecation message instead of registering models from chat. The picker reply is ephemeral and only the invoking user can use it.
File attachments:
fileblocks must point to an attachment reference (attachment://<filename>)- Provide the attachment via
media/path/filePath(single file); usemedia-galleryfor multiple files - Use
filenameto override the upload name when it should match the attachment reference
- Add
components.modalwith up to 5 fields - Field types:
text,checkbox,radio,select,role-select,user-select - OpenClaw adds a trigger button automatically
Access control and routing
- DM policy
- DM access groups
- Guild policy
- Mentions and group DMs
channels.discord.dmPolicy controls DM access. channels.discord.allowFrom is the canonical DM allowlist.pairing(default)allowlistopen(requireschannels.discord.allowFromto include"*")disabled
pairing mode).Multi-account precedence:channels.discord.accounts.default.allowFromapplies only to thedefaultaccount.- For one account,
allowFromtakes precedence over legacydm.allowFrom. - Named accounts inherit
channels.discord.allowFromwhen their ownallowFromand legacydm.allowFromare unset. - Named accounts do not inherit
channels.discord.accounts.default.allowFrom.
channels.discord.dm.policy and channels.discord.dm.allowFrom still read for compatibility. openclaw doctor --fix migrates them to dmPolicy and allowFrom when it can do so without changing access.DM target format for delivery:user:<id><@id>mention
allowFrom are treated as user DM targets for compatibility.Role-based agent routing
Usebindings[].match.roles to route Discord guild members to different agents by role ID. Role-based bindings accept role IDs only and are evaluated after peer or parent-peer bindings and before guild-only bindings. If a binding also sets other match fields (for example peer + guildId + roles), all configured fields must match.
Native commands and command auth
commands.nativedefaults to"auto"and is enabled for Discord.- Per-channel override:
channels.discord.commands.native. commands.native=falseskips Discord slash-command registration and cleanup during startup. Previously registered commands may remain visible in Discord until you remove them from the Discord app.- Native command auth uses the same Discord allowlists/policies as normal message handling.
- Commands may still be visible in Discord UI for users who are not authorized; execution still enforces OpenClaw auth and returns “not authorized”.
ephemeral: true
Feature details
Reply tags and native replies
Reply tags and native replies
Live stream preview
Live stream preview
channels.discord.streaming takes off | partial | block | progress (default). progress keeps one editable status draft and updates it with tool progress until final delivery; the shared starter label is a rolling line, so it scrolls away like the rest once enough work appears. streamMode is a legacy runtime alias. Run openclaw doctor --fix to rewrite persisted config to the canonical key.Set channels.discord.streaming.mode to off to disable Discord preview edits. If Discord block streaming is explicitly enabled, OpenClaw skips the preview stream to avoid double-streaming.partialedits a single preview message as tokens arrive.blockemits draft-sized chunks (usedraftChunkto tune size and breakpoints, clamped totextChunkLimit).- Media, error, and explicit-reply finals cancel pending preview edits.
streaming.preview.toolProgress(defaulttrue) controls whether tool/progress updates reuse the preview message.- Tool/progress rows render as compact emoji + title + detail when available, for example
🛠️ Bash: run testsor🔎 Web Search: for "query". streaming.preview.commandText/streaming.progress.commandTextcontrols command/exec detail in compact progress lines:raw(default) orstatus(tool label only).
block streaming is explicitly enabled, OpenClaw skips the preview stream to avoid double-streaming.History, context, and thread behavior
History, context, and thread behavior
channels.discord.historyLimitdefault20- fallback:
messages.groupChat.historyLimit 0disables
channels.discord.dmHistoryLimitchannels.discord.dms["<user_id>"].historyLimit
- Discord threads route as channel sessions and inherit parent channel config unless overridden.
- Thread sessions inherit the parent channel’s session-level
/modelselection as a model-only fallback; thread-local/modelselections still take precedence and parent transcript history is not copied unless transcript inheritance is enabled. channels.discord.thread.inheritParent(defaultfalse) opts new auto-threads into seeding from the parent transcript. Per-account overrides live underchannels.discord.accounts.<id>.thread.inheritParent.- Message-tool reactions can resolve
user:<id>DM targets. guilds.<guild>.channels.<channel>.requireMention: falseis preserved during reply-stage activation fallback.
Thread-bound sessions for subagents
Thread-bound sessions for subagents
/focus <target>bind current/new thread to a subagent/session target/unfocusremove current thread binding/agentsshow active runs and binding state/session idle <duration|off>inspect/update inactivity auto-unfocus for focused bindings/session max-age <duration|off>inspect/update hard max age for focused bindings
session.threadBindings.*sets global defaults.channels.discord.threadBindings.*overrides Discord behavior.spawnSessionscontrols auto-create/bind threads forsessions_spawn({ thread: true })and ACP thread spawns. Default:true.defaultSpawnContextcontrols native subagent context for thread-bound spawns. Default:"fork".- Deprecated
spawnSubagentSessions/spawnAcpSessionskeys are migrated byopenclaw doctor --fix. - If thread bindings are disabled for an account,
/focusand related thread binding operations are unavailable.
Persistent ACP channel bindings
Persistent ACP channel bindings
bindings[]withtype: "acp"andmatch.channel: "discord"
/acp spawn codex --bind herebinds the current channel or thread in place and keeps future messages on the same ACP session. Thread messages inherit the parent channel binding.- In a bound channel or thread,
/newand/resetreset the same ACP session in place. Temporary thread bindings can override target resolution while active. spawnSessionsgates child thread creation/binding via--thread auto|here.
Reaction notifications
Reaction notifications
offown(default)allallowlist(usesguilds.<id>.users)
Ack reactions
Ack reactions
ackReaction sends an acknowledgement emoji while OpenClaw is processing an inbound message.Resolution order:channels.discord.accounts.<accountId>.ackReactionchannels.discord.ackReactionmessages.ackReaction- agent identity emoji fallback (
agents.list[].identity.emoji, else ”👀”)
- Discord accepts unicode emoji or custom emoji names.
- Use
""to disable the reaction for a channel or account.
Config writes
Config writes
/config set|unset flows (when command features are enabled).Disable:Gateway proxy
Gateway proxy
channels.discord.proxy.PluralKit support
PluralKit support
- allowlists can use
pk:<memberId> - member display names are matched by name/slug only when
channels.discord.dangerouslyAllowNameMatching: true - lookups use original message ID and are time-window constrained
- if lookup fails, proxied messages are treated as bot messages and dropped unless
allowBots=true
Outbound mention aliases
Outbound mention aliases
mentionAliases when agents need deterministic outbound mentions for known Discord users. Keys are handles without the leading @; values are Discord user IDs. Unknown handles, @everyone, @here, and mentions inside Markdown code spans are left unchanged.Presence configuration
Presence configuration
- 0: Playing
- 1: Streaming (requires
activityUrl) - 2: Listening
- 3: Watching
- 4: Custom (uses the activity text as the status state; emoji is optional)
- 5: Competing
autoPresence.healthyTextautoPresence.degradedTextautoPresence.exhaustedText(supports{reason}placeholder)
Approvals in Discord
Approvals in Discord
channels.discord.execApprovals.enabledchannels.discord.execApprovals.approvers(optional; falls back tocommands.ownerAllowFromwhen possible)channels.discord.execApprovals.target(dm|channel|both, default:dm)agentFilter,sessionFilter,cleanupAfterResolve
enabled is unset or "auto" and at least one approver can be resolved, either from execApprovals.approvers or from commands.ownerAllowFrom. Discord does not infer exec approvers from channel allowFrom, legacy dm.allowFrom, or direct-message defaultTo. Set enabled: false to disable Discord as a native approval client explicitly.For sensitive owner-only group commands such as /diagnostics and /export-trajectory, OpenClaw sends approval prompts and final results privately. It tries Discord DM first when the invoking owner has a Discord owner route; if that is not available, it falls back to the first available owner route from commands.ownerAllowFrom, such as Telegram.When target is channel or both, the approval prompt is visible in the channel. Only resolved approvers can use the buttons; other users receive an ephemeral denial. Approval prompts include the command text, so only enable channel delivery in trusted channels. If the channel ID cannot be derived from the session key, OpenClaw falls back to DM delivery.Discord also renders the shared approval buttons used by other chat channels. The native Discord adapter mainly adds approver DM routing and channel fanout.
When those buttons are present, they are the primary approval UX; OpenClaw
should only include a manual /approve command when the tool result says
chat approvals are unavailable or manual approval is the only path.
If the Discord native approval runtime is not active, OpenClaw keeps the
local deterministic /approve <id> <decision> prompt visible. If the
runtime is active but a native card cannot be delivered to any target,
OpenClaw sends a same-chat fallback notice with the exact /approve
command from the pending approval.Gateway auth and approval resolution follow the shared Gateway client contract (plugin: IDs resolve through plugin.approval.resolve; other IDs through exec.approval.resolve). Approvals expire after 30 minutes by default.See Exec approvals.Tools and action gates
Discord message actions include messaging, channel admin, moderation, presence, and metadata actions. Core examples:- messaging:
sendMessage,readMessages,editMessage,deleteMessage,threadReply - reactions:
react,reactions,emojiList - moderation:
timeout,kick,ban - presence:
setPresence
event-create action accepts an optional image parameter (URL or local file path) to set the scheduled event cover image.
Action gates live under channels.discord.actions.*.
Default gate behavior:
| Action group | Default |
|---|---|
| reactions, messages, threads, pins, polls, search, memberInfo, roleInfo, channelInfo, channels, voiceStatus, events, stickers, emojiUploads, stickerUploads, permissions | enabled |
| roles | disabled |
| moderation | disabled |
| presence | disabled |
Components v2 UI
OpenClaw uses Discord components v2 for exec approvals and cross-context markers. Discord message actions can also acceptcomponents for custom UI (advanced; requires constructing a component payload via the discord tool), while legacy embeds remain available but are not recommended.
channels.discord.ui.components.accentColorsets the accent color used by Discord component containers (hex).- Set per account with
channels.discord.accounts.<id>.ui.components.accentColor. embedsare ignored when components v2 are present.
Voice
Discord has two distinct voice surfaces: realtime voice channels (continuous conversations) and voice message attachments (the waveform preview format). The gateway supports both.Voice channels
Setup checklist:- Enable Message Content Intent in the Discord Developer Portal.
- Enable Server Members Intent when role/user allowlists are used.
- Invite the bot with
botandapplications.commandsscopes. - Grant Connect, Speak, Send Messages, and Read Message History in the target voice channel.
- Enable native commands (
commands.nativeorchannels.discord.commands.native). - Configure
channels.discord.voice.
/vc join|leave|status to control sessions. The command uses the account default agent and follows the same allowlist and group policy rules as other Discord commands.
voice.ttsoverridesmessages.ttsfor voice playback only.voice.modeloverrides the LLM used for Discord voice channel responses only. Leave it unset to inherit the routed agent model. Do not set this togpt-realtime-2; Discord voice channels use STT plus TTS playback, not the OpenAI Realtime session transport.- STT uses
tools.media.audio;voice.modeldoes not affect transcription. - For an OpenAI voice on Discord playback, set
voice.tts.provider: "openai"and choose a Text-to-speech voice undervoice.tts.openai.voiceorvoice.tts.providers.openai.voice.cedaris a good masculine-sounding choice on the current OpenAI TTS model. - Per-channel Discord
systemPromptoverrides apply to voice transcript turns for that voice channel. - Voice transcript turns derive owner status from Discord
allowFrom(ordm.allowFrom); non-owner speakers cannot access owner-only tools (for examplegatewayandcron). - Discord voice is opt-in for text-only configs; set
channels.discord.voice.enabled=true(or keep an existingchannels.discord.voiceblock) to enable/vccommands, the voice runtime, and theGuildVoiceStatesgateway intent. channels.discord.intents.voiceStatescan explicitly override voice-state intent subscription. Leave it unset for the intent to follow effective voice enablement.voice.daveEncryptionandvoice.decryptionFailureTolerancepass through to@discordjs/voicejoin options.@discordjs/voicedefaults aredaveEncryption=trueanddecryptionFailureTolerance=24if unset.voice.connectTimeoutMscontrols the initial@discordjs/voiceReady wait for/vc joinand auto-join attempts. Default:30000.voice.reconnectGraceMscontrols how long OpenClaw waits for a disconnected voice session to begin reconnecting before destroying it. Default:15000.- Voice playback does not stop just because another user starts speaking. To avoid feedback loops, OpenClaw ignores new voice capture while TTS is playing; speak after playback finishes for the next turn.
voice.captureSilenceGraceMscontrols how long OpenClaw waits after Discord reports a speaker has stopped before finalizing that audio segment for STT. Default:2500; raise this if Discord splits normal pauses into choppy partial transcripts.- When ElevenLabs is the selected TTS provider, Discord voice playback uses streaming TTS and starts from the provider response stream. Providers without streaming support fall back to the synthesized temp-file path.
- OpenClaw also watches receive decrypt failures and auto-recovers by leaving/rejoining the voice channel after repeated failures in a short window.
- If receive logs repeatedly show
DecryptionFailed(UnencryptedWhenPassthroughDisabled)after updating, collect a dependency report and logs. The bundled@discordjs/voiceline includes the upstream padding fix from discord.js PR #11449, which closed discord.js issue #11419. The operation was abortedreceive events are expected when OpenClaw finalizes a captured speaker segment; they are verbose diagnostics, not warnings.- Verbose Discord voice logs include a bounded one-line STT transcript preview for each accepted speaker segment, so debugging shows both the user side and the agent reply side without dumping unbounded transcript text.
- Discord PCM capture is converted to a WAV temp file.
tools.media.audiohandles STT, for exampleopenai/gpt-4o-mini-transcribe.- The transcript is sent through Discord ingress and routing while the response LLM runs with a voice-output policy that hides the agent
ttstool and asks for returned text, because Discord voice owns final TTS playback. voice.model, when set, overrides only the response LLM for this voice-channel turn.voice.ttsis merged overmessages.tts; streaming-capable providers feed the player directly, otherwise the resulting audio file is played in the joined channel.
voice.model, STT auth for tools.media.audio, and TTS auth for messages.tts/voice.tts.
Voice messages
Discord voice messages show a waveform preview and require OGG/Opus audio. OpenClaw generates the waveform automatically, but needsffmpeg and ffprobe on the gateway host to inspect and convert.
- Provide a local file path (URLs are rejected).
- Omit text content (Discord rejects text + voice message in the same payload).
- Any audio format is accepted; OpenClaw converts to OGG/Opus as needed.
Troubleshooting
Used disallowed intents or bot sees no guild messages
Used disallowed intents or bot sees no guild messages
- enable Message Content Intent
- enable Server Members Intent when you depend on user/member resolution
- restart gateway after changing intents
Guild messages blocked unexpectedly
Guild messages blocked unexpectedly
- verify
groupPolicy - verify guild allowlist under
channels.discord.guilds - if guild
channelsmap exists, only listed channels are allowed - verify
requireMentionbehavior and mention patterns
Require mention false but still blocked
Require mention false but still blocked
groupPolicy="allowlist"without matching guild/channel allowlistrequireMentionconfigured in the wrong place (must be underchannels.discord.guildsor channel entry)- sender blocked by guild/channel
usersallowlist
Long-running Discord turns or duplicate replies
Long-running Discord turns or duplicate replies
Slow listener detected ...stuck session: sessionKey=agent:...:discord:... state=processing ...
- single-account:
channels.discord.eventQueue.listenerTimeout - multi-account:
channels.discord.accounts.<accountId>.eventQueue.listenerTimeout - this only controls Discord gateway listener work, not agent turn lifetime
Gateway metadata lookup timeout warnings
Gateway metadata lookup timeout warnings
/gateway/bot metadata before connecting. Transient failures fall back to Discord’s default gateway URL and are rate-limited in logs.Metadata timeout knobs:- single-account:
channels.discord.gatewayInfoTimeoutMs - multi-account:
channels.discord.accounts.<accountId>.gatewayInfoTimeoutMs - env fallback when config is unset:
OPENCLAW_DISCORD_GATEWAY_INFO_TIMEOUT_MS - default:
30000(30 seconds), max:120000
Gateway READY timeout restarts
Gateway READY timeout restarts
READY event during startup and after runtime reconnects. Multi-account setups with startup staggering can need a longer startup READY window than the default.READY timeout knobs:- startup single-account:
channels.discord.gatewayReadyTimeoutMs - startup multi-account:
channels.discord.accounts.<accountId>.gatewayReadyTimeoutMs - startup env fallback when config is unset:
OPENCLAW_DISCORD_READY_TIMEOUT_MS - startup default:
15000(15 seconds), max:120000 - runtime single-account:
channels.discord.gatewayRuntimeReadyTimeoutMs - runtime multi-account:
channels.discord.accounts.<accountId>.gatewayRuntimeReadyTimeoutMs - runtime env fallback when config is unset:
OPENCLAW_DISCORD_RUNTIME_READY_TIMEOUT_MS - runtime default:
30000(30 seconds), max:120000
Permissions audit mismatches
Permissions audit mismatches
channels status --probe permission checks only work for numeric channel IDs.If you use slug keys, runtime matching can still work, but probe cannot fully verify permissions.DM and pairing issues
DM and pairing issues
- DM disabled:
channels.discord.dm.enabled=false - DM policy disabled:
channels.discord.dmPolicy="disabled"(legacy:channels.discord.dm.policy) - awaiting pairing approval in
pairingmode
Bot to bot loops
Bot to bot loops
channels.discord.allowBots=true, use strict mention and allowlist rules to avoid loop behavior.
Prefer channels.discord.allowBots="mentions" to only accept bot messages that mention the bot.Voice STT drops with DecryptionFailed(...)
Voice STT drops with DecryptionFailed(...)
- keep OpenClaw current (
openclaw update) so the Discord voice receive recovery logic is present - confirm
channels.discord.voice.daveEncryption=true(default) - start from
channels.discord.voice.decryptionFailureTolerance=24(upstream default) and tune only if needed - watch logs for:
discord voice: DAVE decrypt failures detecteddiscord voice: repeated decrypt failures; attempting rejoin
- if failures continue after automatic rejoin, collect logs and compare against the upstream DAVE receive history in discord.js #11419 and discord.js #11449
Configuration reference
Primary reference: Configuration reference - Discord.High-signal Discord fields
High-signal Discord fields
- startup/auth:
enabled,token,accounts.*,allowBots - policy:
groupPolicy,dm.*,guilds.*,guilds.*.channels.* - command:
commands.native,commands.useAccessGroups,configWrites,slashCommand.* - event queue:
eventQueue.listenerTimeout(listener budget),eventQueue.maxQueueSize,eventQueue.maxConcurrency - gateway:
gatewayInfoTimeoutMs,gatewayReadyTimeoutMs,gatewayRuntimeReadyTimeoutMs - reply/history:
replyToMode,historyLimit,dmHistoryLimit,dms.*.historyLimit - delivery:
textChunkLimit,chunkMode,maxLinesPerMessage - streaming:
streaming(legacy alias:streamMode),streaming.preview.toolProgress,draftChunk,blockStreaming,blockStreamingCoalesce - media/retry:
mediaMaxMb(caps outbound Discord uploads, default100MB),retry - actions:
actions.* - presence:
activity,status,activityType,activityUrl - UI:
ui.components.accentColor - features:
threadBindings, top-levelbindings[](type: "acp"),pluralkit,execApprovals,intents,agentComponents,heartbeat,responsePrefix
Safety and operations
- Treat bot tokens as secrets (
DISCORD_BOT_TOKENpreferred in supervised environments). - Grant least-privilege Discord permissions.
- If command deploy/state is stale, restart gateway and re-check with
openclaw channels status --probe.