Discord 接入
Discord Bot 支持服务器、频道和 DM,功能丰富。需要 5 分钟。
步骤
1. 创建 Discord 应用
- 打开 Discord Developer Portal
- New Application → 命名 → Create
- 左侧 Bot → Reset Token → 复制 Bot Token
- 重要:开启 Message Content Intent(否则 Bot 收不到消息内容)
2. 邀请 Bot 到服务器
- OAuth2 → URL Generator
- Scopes 勾选
bot - Bot Permissions 勾选:Send Messages, Read Message History, Add Reactions
- 复制 URL,浏览器打开,授权到服务器
3. 配置 OpenClaw
bash
openclaw channels add --channel discord --token "YOUR_BOT_TOKEN"
openclaw gateway restart或编辑配置:
json5
{
channels: {
discord: {
enabled: true,
botToken: "YOUR_BOT_TOKEN",
dmPolicy: "pairing",
}
}
}4. 测试
在 Discord 中 @mention Bot 或发 DM。
获取 Discord User ID
- Discord 设置 → 高级 → 开启 开发者模式
- 右键点击头像 → Copy User ID
- 格式:
discord:123456789012345678
功能支持
| 功能 | 支持 |
|---|---|
| 文本消息 | ✅ |
| 图片/文件 | ✅ |
| Emoji 反应 | ✅ |
| 嵌入 (Embed) | ✅ |
| 线程回复 | ✅ |
| Slash 命令 | ✅ |