Skip to content

Discord 接入

Discord Bot 支持服务器、频道和 DM,功能丰富。需要 5 分钟。

步骤

1. 创建 Discord 应用

  1. 打开 Discord Developer Portal
  2. New Application → 命名 → Create
  3. 左侧 Bot → Reset Token → 复制 Bot Token
  4. 重要:开启 Message Content Intent(否则 Bot 收不到消息内容)

2. 邀请 Bot 到服务器

  1. OAuth2 → URL Generator
  2. Scopes 勾选 bot
  3. Bot Permissions 勾选:Send Messages, Read Message History, Add Reactions
  4. 复制 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

  1. Discord 设置 → 高级 → 开启 开发者模式
  2. 右键点击头像 → Copy User ID
  3. 格式:discord:123456789012345678

功能支持

功能支持
文本消息
图片/文件
Emoji 反应
嵌入 (Embed)
线程回复
Slash 命令

基于 OpenClaw 开源项目