name: wechat-check-online
检查当前微信账号是否在线。返回 data: true 表示在线,可以继续后续操作;false 表示掉线,需要重新登录。
Step 1:读取后端地址(从 ~/.openclaw/wechat-credentials.json)并调用 /login/check-online。用 exec/bash 工具执行:
API_BASE=$(node -e "console.log(JSON.parse(require('fs').readFileSync(require('path').join(require('os').homedir(),'.openclaw','wechat-credentials.json'),'utf8')).wechatApiBase)")
curl -s --max-time 10 -X POST "$API_BASE/login/check-online" \
-H "Content-Type: application/json" \
-d '{}'
Step 2:解析响应。后端返回 JSON:
{ "ret": 200, "msg": "success", "data": true }
data: true → 在线,告诉用户"微信在线"并继续用户的原始任务data: false → 离线,告诉用户"微信当前离线,请先扫码登录"ret != 200 → 接口异常,把 msg 内容回报给用户wechat-check-online 当成 shell 命令去跑,它没有对应的可执行文件wechat-* 技能直接提供,不存在"渠道"概念~/.openclaw/wechat-credentials.json 的 wechatApiBase 字段决定,已预填为 http://8.138.37.248/api/wechat-agent