Discord Hub Builder
Builds a complete AI command center Discord server via API. No manual steps.
What Gets Built
Categories & Channels:
- - COMMAND CENTER → #daily-brief, #task-queue
- AGENT CHANNELS → #agent-openclaw, #agent-perplexity, #agent-manus
- RESEARCH & OUTPUTS → #financial-briefs, #content-drafts, #research-archive
- OPERATIONS → #agent-logs, #ops-notes, #personal
Roles: Agent (blue), Reviewer (green)
Workflow Cards: Pinned in each agent channel with TOOL / TRIGGER / INPUT / OUTPUT / FREQUENCY
Prerequisites
Before running, confirm the user has:
- 1. A Discord bot — created at https://discord.com/developers/applications
- Bot permissions:
Manage Channels, Manage Roles, Send Messages, Manage Messages (for pinning) - Bot invited to the server — use OAuth2 URL with
bot scope + above permissions - Guild ID — right-click server name → Copy Server ID (Developer Mode must be on)
- Bot token — from the Bot tab in developer portal
If the user doesn't have these, walk through setup before running.
Execution
Dry run first (always)
CODEBLOCK0
Show the user the preview. Confirm before live run.
Live run
CODEBLOCK1
The script:
- - Creates roles (skips if already exist by name)
- Creates all categories and channels
- Posts and pins workflow cards in agent channels
- Prints channel IDs on completion
After Build
Tell the user:
- 1. Set channel-specific permissions manually for
#task-queue (Owner-only send) and readonly channels — Discord's permission API requires role IDs which vary per server - To add more agent channels: copy an existing agent channel block in the script and re-run
- Workflow cards can be edited by finding the pinned message in each agent channel
Error Handling
If the script fails mid-run:
- - Re-running is safe — roles skip if they exist by name
- Channels don't have dedup logic; re-run will create duplicates — delete extras manually or use the dry-run to check state first
- Rate limit errors (429): add
time.sleep(1) between calls or wait and retry
Discord Hub Builder
通过API构建一个完整的AI指令中心Discord服务器。无需手动操作。
构建内容
分类与频道:
- - 指挥中心 → #每日简报, #任务队列
- 代理频道 → #agent-openclaw, #agent-perplexity, #agent-manus
- 研究与输出 → #财务简报, #内容草稿, #研究档案
- 运营管理 → #代理日志, #运营笔记, #个人
角色: 代理(蓝色),审核员(绿色)
工作流卡片: 固定在每个代理频道中,包含工具/触发器/输入/输出/频率
前置条件
运行前,请确认用户已具备:
- 1. 一个Discord机器人 — 在 https://discord.com/developers/applications 创建
- 机器人权限: 管理频道、管理角色、发送消息、管理消息(用于固定消息)
- 机器人已邀请到服务器 — 使用包含bot作用域及上述权限的OAuth2 URL
- 服务器ID — 右键点击服务器名称 → 复制服务器ID(需开启开发者模式)
- 机器人令牌 — 从开发者门户的Bot选项卡获取
如果用户尚未准备就绪,请在运行前引导完成设置。
执行
先进行试运行(始终执行)
bash
python3 scripts/build_hub.py --token 机器人令牌 --guild 服务器ID --dry-run
向用户展示预览结果。确认后再进行正式运行。
正式运行
bash
python3 scripts/build_hub.py --token 机器人令牌 --guild 服务器ID
脚本将:
- - 创建角色(若名称已存在则跳过)
- 创建所有分类和频道
- 在代理频道中发布并固定工作流卡片
- 完成后打印频道ID
构建完成后
告知用户:
- 1. 手动设置#任务队列(仅限所有者发送)和只读频道的频道特定权限 — Discord的权限API需要角色ID,而不同服务器的角色ID各不相同
- 如需添加更多代理频道:复制脚本中现有的代理频道模块并重新运行
- 可通过查找每个代理频道中的固定消息来编辑工作流卡片
错误处理
如果脚本在运行中途失败:
- - 重新运行是安全的 — 角色若名称已存在则会跳过
- 频道没有去重逻辑;重新运行会创建重复频道 — 手动删除多余的频道,或先使用试运行检查状态
- 速率限制错误(429):在调用之间添加time.sleep(1),或等待后重试