CA
文档首页

Discord

当你希望在 Discord 私信或 server 中访问 Agent 时,可以连接 Discord。

前提条件

  • 已有 Cloud Agents Agent。
  • 有权限创建 Discord application。
  • 有权限把 bot 邀请到目标 server。

创建 Discord application

  1. 打开 Discord Developer Portal
  2. 创建新的 application。
  3. 打开 Bot 并创建 bot user。
  4. Reset 并复制 bot token。
  5. 在 Privileged Gateway Intents 下启用 Message Content Intent。

Message Content Intent 是必需的。如果没有启用,Cloud Agents 可以连接 bot,但无法读取用户 prompt。

邀请 bot

打开 OAuth2 URL Generator:

  1. 选择 bot scope。
  2. 选择这些 bot permissions:
Permission用途
View Channels让 bot 看到目标频道中的消息。
Send Messages发送 Agent 回复。
Read Message History读取 Gateway 投递的消息上下文。

复制生成的 URL,打开它,并把 bot 邀请到 server。

连接到 Cloud Agents

  1. 打开 Settings -> Channels
  2. 创建新渠道并选择 Discord。
  3. 选择要接收消息的 Agent。
  4. 输入标签并粘贴 bot token。
  5. 可以选择限制到指定 server。
  6. 创建渠道。
  7. 运行渠道测试。

Discord 不需要你在 Discord 中粘贴 inbound URL。

推荐设置

设置建议
Allowed servers当 bot 加入多个 server 时,限制到已知 server ID。
Mention onlyserver 中建议开启,让 Agent 只在被 mention 时回复。DM 仍然可用。
Shared session默认关闭,除非 server 频道中的所有人都应该共享同一段对话。
Progress mode如果希望 Agent 工作时更新同一条消息,使用 preview。

验证

打开渠道详情页并运行 Test。健康的渠道会确认 bot 身份和 Message Content Intent 状态。

排查问题

  • Message Content Intent 未启用:在 Developer Portal 中启用,然后重新测试渠道。
  • Bot 已连接但忽略 server 消息:mention bot,或关闭 mention-only 模式。
  • 某个 server 的消息被忽略:检查 allowed server 列表。
  • Bot 无法发送回复:用 View Channels、Send Messages 和 Read Message History 权限重新邀请它。

另请参阅