健康检查(CLI)
无需猜测即可验证频道连通性的简短指南。
快速检查
moltbot status— 本地摘要:网关可达性/模式、更新提示、关联频道认证时长、会话与近期活动。moltbot status --all— 完整本地诊断(只读、彩色、可安全粘贴用于调试)。moltbot status --deep— 同时探测运行中的网关(在支持时进行每频道探测)。moltbot health --json— 向运行中的网关请求完整健康快照(仅 WS;无直接 Baileys 套接字)。- 在 WhatsApp/WebChat 中单独发送
/status可得到状态回复而不触发代理。 - 日志:跟踪
/tmp/moltbot/moltbot-*.log并过滤web-heartbeat、web-reconnect、web-auto-reply、web-inbound。
深度诊断
- 磁盘凭证:
ls -l ~/.clawdbot/credentials/whatsapp/<accountId>/creds.json(mtime 应为近期)。 - 会话存储:
ls -l ~/.clawdbot/agents/<agentId>/sessions/sessions.json(路径可在配置中覆盖)。数量与近期收件人通过status显示。 - 重新链接流程:当日志出现 409–515 或
loggedOut时,使用moltbot channels logout && moltbot channels login --verbose。(注:QR 登录流程在配对后对 515 会自动重启一次。)
出问题时
logged out或 409–515 → 用moltbot channels logout然后moltbot channels login重新链接。- 网关不可达 → 启动:
moltbot gateway --port 18789(端口占用时用--force)。 - 无入站消息 → 确认已链接手机在线且发送者在允许列表(
channels.whatsapp.allowFrom);群聊需确保白名单与提及规则匹配(channels.whatsapp.groups、agents.list[].groupChat.mentionPatterns)。
专用「health」命令
moltbot health --json 向运行中的网关请求其健康快照(CLI 不直接连接频道套接字)。会报告已链接凭证/认证时长(如有)、每频道探测摘要、会话存储摘要及探测耗时。若网关不可达或探测失败/超时则非零退出。使用 --timeout <ms> 覆盖默认 10s。
最后更新于: