Discord
把 Discord Bot 接到 Agent —— 按服务器 / 按频道授权、多服务器路由。
Discord 是 ToShop 另一个头等连接。配一个 Bot,限定到特定服务器和频道,Agent 就出现在你团队已经在聊的地方。
配置
创建 Discord App
在 discord.com/developers → New Application → Bot → 复制 Bot Token。
开启 Message Content Intent
必开 —— 不然 Bot 看不到消息正文
同一页面:Bot → Privileged Gateway Intents → Message Content Intent。打开。
邀请 Bot 进服务器
用 Discord 开发者门户的 OAuth2 邀请链接把 Bot 加到你的服务器。最小权限:读消息、发消息、读历史。
在 ToShop 接入
打开页面左边栏的 连接 入口 → Add Connection,选 Discord,按提示把 Bot 接上。凭证存进系统钥匙串。
凭证与策略
- Bot Token —— Discord 开发者门户的 Token。存系统钥匙串。
- Guild ID —— 这个 Bot 服务的 Discord 服务器 ID。
- Channel ID(可选) —— 限定到该服务器的某一个频道。
- Allowed channels —— 多个频道 ID 列表(代替单一 Channel ID)。
- Group policy —— Allowlist(默认 —— 仅列表内频道)或 Open(服务器内 Bot 可见的任意频道)。
在 Discord 里找 ID
消息路由
私信 Bot
与绑定 Agent 的 1:1 会话。
频道里 @ 它
Agent 回应 @-mention,同一线程内的后续回复保留上下文。
斜杠命令
按 Agent 配过的话,用户能用结构化命令快速触发。
一个 Agent 多个 Discord 服务器
一个 Agent 可绑定多个 Discord 服务器(例如团队主服务器 + 客户支持服务器)。各服务器自有频道上下文,但同一个 Agent 处理全部。
怎样保持在线
ToShop 用 Discord 的实时网关让你的 Bot 在线。斜杠命令交互走 Webhook。这些不用你配 —— ToShop 自动选合适的方式。
服务器侧的坑
状态指示
和 Telegram 同套:Connected、Standby、Degraded、Disconnected —— 在页面左边栏 连接 入口的每张连接卡上。
常见模式
团队问答 Bot
在 #help 频道里回答 runbook、代码库、Shopify 商品的问题。
运维 Dashboard 频道
例行任务 把每日摘要发到 #ops。
审批闸频道
长任务需要人工放行时往 #approvals 弹。
按频道分技能
#shop-ops 路由到店铺 Agent(仅 Shopify);#dev-ops 路由到 Dev Agent(GitHub + 终端)。
ToShop文档