通过 openclaw-weixin 发送文件到微信
背景
Agent 模式的 MEDIA: directive 在 openclaw-weixin 渠道上只支持图片,不支持其他格式文件(.md、.pdf、.zip 等)。
解法: 用 openclaw message send CLI 命令直接发文件,不走 agent 的 MEDIA 解析链路。
命令
openclaw message send \
--channel openclaw-weixin \
--account <accountId> \
--target "<微信会话ID>" \
--media /path/to/file \
--message "说明文字"参数说明
| 参数 | 说明 | 获取方式 |
|---|---|---|
--channel | 固定 openclaw-weixin | - |
--account | WeChat 插件的 accountId | 从 openclaw.json 配置的 channels.openclaw-weixin.accountId 获取 |
--target | 微信会话 ID | 从会话上下文的 deliveryContext.to 获取(格式如 xxxxxxxxxxx@im.wechat) |
--media | 要发送的文件路径 | 本地绝对路径 |
--message | 文件附带说明文字 | 可选 |
示例
openclaw message send \
--channel openclaw-weixin \
--account <你的accountId> \
--target "<微信会话ID>" \
--media /path/to/file \
--message "说明文字"注意事项
- 插件加载需要 30s+,
exec执行时 timeout 要设够长(>60s) - 如果命令被 SIGTERM/SIGKILL 中断,不一定是失败——先检查日志是否有
✅ Sent via openclaw-weixin - 不要因为看起来 "没反应" 就重复执行,避免多发
- 图片仍然建议用
MEDIA:directive 发送(微信原生支持) - 该命令不走 agent 推理流程,零 token 消耗