Discord Connect Wizard (OpenClaw)
Run a localhost setup wizard that minimizes manual Discord steps.
Non-negotiable manual steps (Discord security):
- - Complete Discord login / CAPTCHA / 2FA if prompted
- Copy the Bot Token once
- Click OAuth authorize once
- If DM pairing is needed: enable DMs in server privacy settings (Discord-side)
Wizard does:
- - Creates a NEW OpenClaw
channels.discord.accounts.<accountId> entry (never overwrites existing bots) - Discovers guild/user IDs
- Writes config via INLINECODE1
- Restarts gateway and approves pairing for that account
Quick start
Conversation mode (recommended)
Use browser automation + chat prompts. No localhost UI required.
Hard requirement: agent opens and drives the Developer Portal via browser tool (do not ask user to open pages or click around).
Resilience rule: if the browser tool times out / disconnects, the agent must self-recover (restart gateway/browser as needed) and retry. Only ask the user to click if recovery is impossible.
UX rule: whenever the user must act (login/CAPTCHA/MFA/OAuth authorize), send a screenshot + ONE instruction line.
If you need a deterministic step list, run:
node scripts/conversation-checklist.mjs
Then follow
references/conversation-mode.md.
Localhost UI mode (optional)
CODEBLOCK1
Workflow
1) Create bot + enable intents (guided)
User steps you will see on screen:
- - Welcome to the Developer Portal popup → click Log In (or Create Account)
- Complete any required login / CAPTCHA / 2FA (agent cannot bypass Discord security)
Then (agent-guided):
- - Create app → Bot → enable Message Content Intent (required)
- Copy Bot Token (paste into wizard)
2) Invite bot to your server (guided)
Wizard generates an invite URL with scopes:
and baseline permissions:
- - View Channels, Send Messages, Read Message History, Embed Links, Attach Files (+ Add Reactions optional)
You still need to select the server and click Authorize.
3) Auto-discover IDs (automatic)
- - Server ID: fetched from bot guild list after invite (if multiple, pick by name in wizard)
- Your User ID: fetched from your first DM to the bot (“hi”) (no Developer Mode copy/paste)
4) Write OpenClaw config + restart (automatic)
Wizard writes:
- - INLINECODE5
- INLINECODE6
- INLINECODE7
- INLINECODE8
- INLINECODE9
Then runs openclaw gateway restart.
5) Pairing (semi-automatic)
- - You DM the bot once
- Wizard extracts the pairing code and runs INLINECODE11
Browser automation (optional)
If an OpenClaw agent with the
browser tool is available, use it to:
- - open Developer Portal pages
- scroll to the right sections (Intents, Token, OAuth URL generator)
- capture screenshots of the exact UI that requires user involvement (login/CAPTCHA/2FA, OAuth Authorize)
Do not attempt to bypass CAPTCHA/2FA; pause for manual completion.
Files
- -
scripts/wizard.mjs: localhost wizard server + OpenClaw config writer - INLINECODE14 : official baseline config + troubleshooting pointers
Discord Connect Wizard (OpenClaw)
运行一个本地主机设置向导,最大限度减少手动操作 Discord 的步骤。
不可协商的手动步骤(Discord 安全机制):
- - 如果提示,完成 Discord 登录 / 验证码 / 双重认证
- 复制一次机器人令牌
- 点击一次 OAuth 授权
- 如果需要私信配对:在服务器隐私设置中启用私信(Discord 端)
向导执行的操作:
- - 创建一个新的 OpenClaw channels.discord.accounts. 条目(从不覆盖现有机器人)
- 发现公会/用户 ID
- 通过 openclaw config set ... --json 写入配置
- 重启网关并批准该账户的配对
快速开始
对话模式(推荐)
使用浏览器自动化 + 聊天提示。无需本地主机界面。
硬性要求:代理通过浏览器工具打开并操作开发者门户(不要要求用户打开页面或点击操作)。
恢复规则:如果浏览器工具超时/断开连接,代理必须自行恢复(根据需要重启网关/浏览器)并重试。仅在无法恢复时才要求用户点击。
用户体验规则:每当用户必须操作时(登录/验证码/多重认证/OAuth 授权),发送截图 + 一条指令。
如果需要确定性的步骤列表,运行:
bash
node scripts/conversation-checklist.mjs
然后参考 references/conversation-mode.md。
本地主机界面模式(可选)
bash
cd
node scripts/wizard.mjs
打开 http://127.0.0.1:8787
工作流程
1) 创建机器人 + 启用意图(引导式)
您将在屏幕上看到的用户步骤:
- - 欢迎来到开发者门户弹窗 → 点击登录(或创建账户)
- 完成任何必要的登录 / 验证码 / 双重认证(代理无法绕过 Discord 安全机制)
然后(代理引导):
- - 创建应用 → 机器人 → 启用消息内容意图(必需)
- 复制机器人令牌(粘贴到向导中)
2) 邀请机器人到您的服务器(引导式)
向导生成带有以下范围的邀请链接:
- - bot
- applications.commands
以及基础权限:
- - 查看频道、发送消息、读取消息历史、嵌入链接、附加文件(+ 可选:添加反应)
您仍需选择服务器并点击授权。
3) 自动发现 ID(自动)
- - 服务器 ID:邀请后从机器人公会列表中获取(如果有多个,在向导中按名称选择)
- 您的用户 ID:从您发送给机器人的第一条私信(hi)中获取(无需开发者模式复制/粘贴)
4) 写入 OpenClaw 配置 + 重启(自动)
向导写入:
- - channels.discord.enabled=true
- channels.discord.token=...
- channels.discord.groupPolicy=allowlist
- channels.discord.guilds..requireMention=false
- channels.discord.guilds..users=[]
然后运行 openclaw gateway restart。
5) 配对(半自动)
- - 您向机器人发送一次私信
- 向导提取配对码并运行 openclaw pairing approve discord
浏览器自动化(可选)
如果带有 browser 工具的 OpenClaw 代理可用,请使用它来:
- - 打开开发者门户页面
- 滚动到相应部分(意图、令牌、OAuth 链接生成器)
- 截取需要用户参与的精确界面截图(登录/验证码/双重认证、OAuth 授权)
不要尝试绕过验证码/双重认证;暂停等待手动完成。
文件
- - scripts/wizard.mjs:本地主机向导服务器 + OpenClaw 配置写入器
- references/openclaw-discord-baseline.md:官方基础配置 + 故障排除指南