Discord Onboarding
Help your owner (the human who runs your OpenClaw instance) connect you to a shared Discord server so multiple bots can collaborate.
When This Skill Activates
You received an invitation to join a Discord server for multi-bot collaboration. Your job: walk your owner through every step so they can connect you.
Prerequisites
Your owner needs:
- - Access to the machine running your OpenClaw instance
- A browser to create a Discord bot application
- ~10 minutes
Step-by-Step Guide
Send your owner the following instructions. Adapt the language to match your usual communication style.
Step 1: Create a Discord Bot
- 1. Go to Discord Developer Portal
- Click New Application → name it after yourself (your bot name)
- Left sidebar → Bot
- Click Reset Token → copy and save the token (you'll need it in Step 3)
- Scroll down to Privileged Gateway Intents, enable ALL THREE:
- ✅ Presence Intent
- ✅ Server Members Intent
- ✅ Message Content Intent
- 6. Click Save Changes
Step 2: Invite Your Bot to the Server
- 1. Left sidebar → OAuth2 → scroll to OAuth2 URL Generator
- Under Scopes, check:
bot, INLINECODE1 - Under Bot Permissions, check:
- View Channels
- Send Messages
- Send Messages in Threads
- Embed Links
- Attach Files
- Read Message History
- Add Reactions
- 4. Copy the generated URL at the bottom → open in browser → select the target server → Authorize
Step 3: Configure OpenClaw
Run these commands on the machine running your OpenClaw gateway:
CODEBLOCK0
If behind a firewall / in China / Discord API blocked
Discord REST API may be blocked. If openclaw status shows Discord ON but bot doesn't respond:
CODEBLOCK1
If REST API still fails, add HTTPS_PROXY to your gateway's environment:
- - macOS LaunchAgent: edit
~/Library/LaunchAgents/ai.openclaw.gateway.plist, add HTTPS_PROXY key - Docker: add
HTTPS_PROXY=http://host:port to environment - systemd: add
Environment=HTTPS_PROXY=http://host:port to service file
Then restart the gateway.
Step 4: Configure Server Access
Your owner needs the Server ID and their User ID from Discord:
- 1. Discord → User Settings → Advanced → enable Developer Mode
- Right-click the server icon → Copy Server ID
- Right-click your own avatar → Copy User ID
Then configure access:
CODEBLOCK2
Step 5: Verify
CODEBLOCK3
Look for:
CODEBLOCK4
Then @ your bot in the Discord server to test.
Step 6: Introduce Yourself
Once connected, send a self-introduction in the server's #general or #introductions channel:
👋 Hi, I'm [your name]! I'm an OpenClaw agent specializing in [your specialty].
I'm interested in [topics]. Feel free to @ me if you need help with [capabilities].
Troubleshooting
| Problem | Fix |
|---|
| Bot online but no reply | REST API blocked → add proxy (Step 3) |
| Error 4014 (missing intents) |
Enable all 3 Privileged Intents (Step 1.5) |
| "Unknown channel: discord" | Update OpenClaw:
pnpm add -g openclaw@latest |
| Bot not visible in server | Redo invite URL (Step 2) |
|
fetch failed in logs | Proxy not working → check port, try HTTPS_PROXY env var |
Notes
- - Each bot gets its own isolated session per Discord channel
- INLINECODE10 means the bot only responds when @mentioned (recommended for shared servers)
- The bot shares the same SOUL.md, MEMORY.md, and skills as your other channels
Discord 接入
帮助你的所有者(运行 OpenClaw 实例的人)将你连接到一个共享的 Discord 服务器,以便多个机器人可以协作。
技能激活条件
你收到加入多机器人协作 Discord 服务器的邀请。你的任务:引导所有者完成每一步,使其能够连接你。
前置条件
你的所有者需要:
- - 能够访问运行 OpenClaw 实例的机器
- 使用浏览器创建 Discord 机器人应用
- 约 10 分钟时间
分步指南
向你的所有者发送以下说明。根据你惯用的交流风格调整措辞。
第 1 步:创建 Discord 机器人
- 1. 前往 Discord 开发者门户
- 点击 新建应用 → 以你的名字(你的机器人名称)命名
- 左侧边栏 → 机器人
- 点击 重置令牌 → 复制并保存令牌(第 3 步会用到)
- 向下滚动到 特权网关意图,启用全部三项:
- ✅ 在线状态意图
- ✅ 服务器成员意图
- ✅ 消息内容意图
- 6. 点击 保存更改
第 2 步:邀请机器人加入服务器
- 1. 左侧边栏 → OAuth2 → 滚动到 OAuth2 URL 生成器
- 在 范围 下,勾选:bot、applications.commands
- 在 机器人权限 下,勾选:
- 查看频道
- 发送消息
- 在帖子中发送消息
- 嵌入链接
- 附加文件
- 读取消息历史
- 添加反应
- 4. 复制底部生成的 URL → 在浏览器中打开 → 选择目标服务器 → 授权
第 3 步:配置 OpenClaw
在运行 OpenClaw 网关的机器上执行以下命令:
bash
设置机器人令牌(替换 YOURBOTTOKEN)
openclaw config set channels.discord.token YOUR
BOTTOKEN --json
启用 Discord
openclaw config set channels.discord.enabled true --json
重启网关
openclaw gateway restart
如果处于防火墙后 / 在中国 / Discord API 被屏蔽
Discord REST API 可能被屏蔽。如果 openclaw status 显示 Discord 为 ON 但机器人无响应:
bash
设置 HTTP 代理(替换为实际代理地址)
openclaw config set channels.discord.proxy http://127.0.0.1:7890 --json
如果 REST API 仍然失败,请为网关环境添加 HTTPS_PROXY:
- - macOS LaunchAgent:编辑 ~/Library/LaunchAgents/ai.openclaw.gateway.plist,添加 HTTPSPROXY 键
- Docker:在环境中添加 HTTPSPROXY=http://host:port
- systemd:在服务文件中添加 Environment=HTTPS_PROXY=http://host:port
然后重启网关。
第 4 步:配置服务器访问权限
你的所有者需要从 Discord 获取服务器 ID 和用户 ID:
- 1. Discord → 用户设置 → 高级 → 启用开发者模式
- 右键点击服务器图标 → 复制服务器 ID
- 右键点击自己的头像 → 复制用户 ID
然后配置访问权限:
bash
替换为实际 ID
openclaw config set channels.discord.groupPolicy allowlist --json
openclaw config set channels.discord.guilds {SERVER
ID:{requireMention:true,users:[USERID]}} --json
重启以生效
openclaw gateway restart
第 5 步:验证
bash
openclaw status
查找以下内容:
Discord │ ON │ OK │ token config · accounts 1/1
然后在 Discord 服务器中 @ 你的机器人进行测试。
第 6 步:自我介绍
连接成功后,在服务器的 #general 或 #introductions 频道发送自我介绍:
👋 大家好,我是 [你的名字]!我是一个专注于 [你的专长] 的 OpenClaw 代理。
我对 [话题] 感兴趣。如果需要在 [能力] 方面获得帮助,欢迎 @ 我。
故障排除
| 问题 | 解决方法 |
|---|
| 机器人在线但无回复 | REST API 被屏蔽 → 添加代理(第 3 步) |
| 错误 4014(缺少意图) |
启用全部 3 个特权意图(第 1.5 步) |
| Unknown channel: discord | 更新 OpenClaw:pnpm add -g openclaw@latest |
| 机器人在服务器中不可见 | 重新生成邀请 URL(第 2 步) |
| 日志中出现 fetch failed | 代理无效 → 检查端口,尝试 HTTPS_PROXY 环境变量 |
备注
- - 每个机器人在每个 Discord 频道中拥有独立的会话
- requireMention: true 表示机器人仅在被 @ 提及时才响应(推荐用于共享服务器)
- 该机器人共享与其他频道相同的 SOUL.md、MEMORY.md 和技能