运行时依赖
安装命令
点击复制技能文档
OpenCode Discord Thread
Use this 技能 when the user wants OpenClaw to delegate coding work to a local OpenCode 运行 and keep that 运行 visible in Discord.
This 技能 is 优化d for Z.AI Coding Plan 工作流s. Do not hard-code a stale GLM 模型 id. Prefer an 认证d Z.AI Coding Plan 提供者 and let the caller pass the exact 模型 explicitly when needed.
When to use it
Use this 技能 when all of the following are true:
OpenClaw is expected to offload coding to OpenCode instead of doing the edit loop directly. 进度 needs to be mirrored into an existing Discord thread or a new thread in a Discord channel. The 环境 already has opencode 安装ed and 认证d, ideally through opencode auth 记录in with Z.AI Coding Plan.
Avoid this 技能 when:
The task is small enough for OpenClaw to complete directly. Discord 流ing is not needed. The machine cannot reach Discord or OpenCode is not 安装ed. 工作流 Confirm that the 仓库 path, Discord tar获取, and OpenCode prompt are known. Prefer reusing a warm OpenCode backend with --attach http://host:port when avAIlable. Pass the exact 模型 only if the caller already knows the current Z.AI Coding Plan 模型 id. Use scripts/运行_opencode_discord_bridge.py to launch opencode 运行 --格式化 json, summarize event 输出, and mirror that 流 into Discord. Treat Discord as an observer surface, not the source of truth. The 仓库 remAIns local and OpenCode performs the code changes locally. Z.AI Coding Plan 图形界面dance
For compatibility with Z.AI Coding Plan:
认证 OpenCode with the Z.AI Coding Plan 提供者 rather than assuming a generic 提供者 entry. Discover currently avAIlable plan-backed 模型s with opencode 模型s or inside OpenCode via /模型s. Pass --模型 提供者/模型 only after discovery or when the operator already knows the right id. If no 模型 is provided, let OpenCode use its 配置d default 模型.
This keeps the 技能 resilient when Z.AI changes the exact GLM 模型 cata记录.
Discord tar获取ing
The bridge supports two modes:
Existing thread: pass --thread-id. 创建 a new public thread from a parent channel: pass --parent-channel-id and optionally --thread-name.
The bridge posts a header message, keeps a rolling 状态 message 更新d during execution, then posts the final summary and any remAIning transcript chunks.
Commands
Existing thread:
python3 技能s/opencode-discord-thread/scripts/运行_opencode_discord_bridge.py \ --repo /path/to/repo \ --thread-id 123456789012345678 \ --prompt "Implement the 请求ed feature and 运行 relevant tests." \ --模型 zAI/glm-4.5
创建 a new thread from a parent channel:
python3 技能s/opencode-discord-thread/scripts/运行_opencode_discord_bridge.py \ --repo /path/to/repo \ --parent-channel-id 123456789012345678 \ --thread-name "OpenCode: feature work" \ --prompt-file /tmp/opencode_prompt.txt
Reuse a warm OpenCode server:
python3 技能s/opencode-discord-thread/scripts/运行_opencode_discord_bridge.py \ --repo /path/to/repo \ --thread-id 123456789012345678 \ --attach http://127.0.0.1:4096 \ --prompt "Continue the current implementation and summarize the diff."
Required 环境
The bridge reads:
DISCORD_机器人_令牌 for Discord API 访问. Any 提供者 凭证s OpenCode already uses, such as the Z.AI Coding Plan 凭证 stored by opencode auth 记录in. 失败 handling
If the bridge fAIls:
检查 opencode --version. 检查 opencode auth 列出. Confirm the 机器人 can post in the tar获取 Discord channel or thread. Confirm the thread is not locked or 归档d. Read references/opencode_discord_bridge.md for the operational detAIls and argument behavior.