🦀 ClawHub
Openclaw Discord Setup
by @yang1002378395-cmyk
Configure a Discord Bot as an OpenClaw message channel with token setup, server authorization, and slash command support in 10 minutes.
TERMINAL
clawhub install openclaw-discord-setup📖 About This Skill
OpenClaw Discord Setup
10 分钟配置 Discord Bot 作为 OpenClaw 消息渠道。
为什么选 Discord?
快速配置
Step 1: 创建 Discord 应用
1. 访问 https://discord.com/developers/applications 2. 点击 "New Application" 3. 设置名称(如 "My AI Assistant") 4. 进入 "Bot" 页面,点击 "Add Bot" 5. 保存 Token
Step 2: 邀请 Bot 到服务器
在 "OAuth2" > "URL Generator" 中:
bot, applications.commands复制生成的链接,在浏览器打开,选择服务器授权。
Step 3: 配置 OpenClaw
编辑 ~/.openclaw/config.yaml:
plugins:
entries:
- plugin: openclaw-discord
config:
botToken: "YOUR_BOT_TOKEN"
clientId: "YOUR_CLIENT_ID"
allowedGuildIds:
- "123456789" # 服务器 ID
Step 4: 启动 Gateway
openclaw gateway start
Step 5: 测试
在 Discord 频道 @你的 Bot,应该收到 AI 回复。
高级功能
Slash 命令
plugins:
entries:
- plugin: openclaw-discord
config:
botToken: "xxx"
slashCommands:
- name: "ask"
description: "Ask AI a question"
- name: "clear"
description: "Clear conversation history"
多服务器支持
allowedGuildIds:
- "123456789"
- "987654321"
私信支持
allowDM: true
Embed 消息(更美观)
OpenClaw 会自动格式化回复为 Embed 样式。
常见问题
Q: Bot 不响应
A: 检查 Bot Token 是否正确,确保 Bot 在服务器中Q: "Missing Access" 错误
A: 重新生成邀请链接,确保勾选了必要权限Q: Slash 命令不显示
A: 命令注册需要时间(最多 1 小时),或重启 GatewayQ: 如何获取服务器 ID?
A: Discord 设置 > 高级 > 开发者模式,然后右键服务器 > 复制 ID成本
安全建议
1. 不要公开 Bot Token 2. 定期重新生成 Token 3. 只允许信任的服务器 ID 4. 在生产环境使用环境变量
export DISCORD_BOT_TOKEN="your-token-here"
需要帮助?
Version: 1.0.0 Created: 2026-03-21