Discord 是 Sentō 最常见的频道。对新智能体来说是推荐的起点。
创建 bot
- 打开 discord.com/developers/applications
- New Application → 给它起名(随意 —— 实际的智能体名字在
sento init里设) - Bot 标签 → Reset Token → 复制。存到密码管理器里。
- Privileged Gateway Intents:启用 Message Content Intent 和 Server Members Intent。
- OAuth2 → URL Generator:scope 选
bot,权限:View Channels、Send Messages、Send Messages in Threads、Read Message History、Attach Files、Add Reactions。复制生成的 URL,在浏览器里打开,把 bot 加到你的服务器。
找到你的 Server ID
- Discord → Settings → Advanced → Developer Mode ON
- 右键点击你的服务器名 → Copy Server ID
你会在 sento init 时同时粘贴 token 和 server ID。
访问控制
Discord 插件会遵守 ~/.claude/channels/discord/access.json 里的配置:
{
"dmPolicy": "allowlist",
"allowFrom": [],
"groups": {
"<server-id-或-channel-id>": { "requireMention": false, "allowFrom": [] }
}
}
- dmPolicy:
pairing(默认 —— 对陌生发件人回复一个 5 字符代码,等待主人批准)、allowlist(只回复列出的用户 ID)、open、或disabled。 - groups:每个服务器或频道的策略。
requireMention: true意味着 bot 只在被 @ 时响应。
完整讨论:访问控制概念。
常见坑
- Bot 显示离线:运行
sento restart,等 30 秒。如果还离线,看sento logs -n 50找认证错误。 - "Message Content Intent" 错误:你没在 Developer Portal 里启用 intent。回去打开它。
- 智能体不响应:bot 在那个特定频道里没有 View Channel + Send Messages 权限。右键频道 → Edit Channel → Permissions → 添加 bot 的角色。
多服务器 + 多频道
Discord 插件支持多个服务器和每个频道的规则。在 access.json 的 groups 里加更多条目 —— 不用 sento 命令,插件在每条入站消息时会重新读文件。