Phase 6 / Ep 29: Discord 深度集成 —— Bot 创建到服务器部署
🎯 学习目标:在 Discord 服务器中部署 OpenClaw Bot。
1. Discord Developer Portal
- 访问 discord.com/developers
- New Application → 输入名称
- 左侧 Bot → Add Bot → Copy Token
- 左侧 OAuth2 → URL Generator:
- Scopes:
bot,applications.commands - Bot Permissions:
Send Messages,Read Message History,Use Slash Commands
- Scopes:
- 使用生成的 URL 邀请 Bot 到你的服务器
2. 连接到 OpenClaw
openclaw channels add discord --token "MTIzNDU2Nzg5.xxx"
openclaw channels pair <code>
3. 频道绑定 Agent
# #general → personal agent
openclaw agents bind personal discord --channel general
# #dev → code agent
openclaw agents bind code-agent discord --channel dev
# #ops → ops agent
openclaw agents bind ops-agent discord --channel ops
4. CLI vs Telegram vs Discord 三线对照
| 操作 | CLI | Telegram | Discord |
|---|---|---|---|
| 发消息 | openclaw chat "xxx" |
直接发 | 直接发 / @bot |
| 清除会话 | openclaw sessions clear |
/clear |
/clear |
| 查看状态 | openclaw status |
/status |
/status |
| 安装技能 | openclaw skills install xx |
/skills install xx |
/skills install xx |
| 查看日志 | openclaw logs |
/logs |
/logs |
| 切换 Agent | openclaw agents switch xx |
/switch xx |
/switch xx |
5. Discord 特有功能
- Thread 支持:长对话自动创建 Thread
- Embed 富文本:Agent 回复使用 Discord Embed 格式
- 角色权限:限制哪些角色可以与 Agent 交互
- 频道隔离:不同频道绑定不同 Agent
下节预告: Ep 30,多频道路由策略——当 Agent 同时连接 Telegram 和 Discord 时,如何优雅地管理。