Skip to content

fix(onebot11): 处理非零 retcode 请求失败 - #7

Merged
BaizhouziYou merged 2 commits into
mainfrom
codex/onebot11-retcode-error
Nov 11, 2026
Merged

BaizhouziYou merged 2 commits into
mainfrom
codex/onebot11-retcode-error

Conversation

@Minecraft0122

Copy link
Copy Markdown
Contributor

变更说明

参考 AstrBot 的 aiocqhttp OneBot v11 请求处理:API 响应只要 status 为 failed 或 retcode 非零,就应作为请求失败交给调用方处理。

EasyBot 原先的运行时 WebSocket readLoop 仅检查 status == failed。部分 OneBot 实现会返回 status: ok 搭配非零 retcode,导致 send_group_msg、send_private_msg 和其他请求被错误报告为成功。本 PR 统一使用非零 retcode 失败判定,并增加真实 WebSocket 回归测试。

验证

  • go test ./internal/adapter/onebot11
  • go test ./...
  • go vet ./...
  • git diff --check
  • 手工审阅 OneBot mock:身份查询成功后返回 status: ok, retcode: 100,调用结果为 adapter_api_failed

前端 npm ci 在 Windows 清理已有 node_modules/@lucide/vue/.../icons 时遇到 ENOTEMPTY,因此 npm run build 未能执行(现有依赖下运行时也缺少 vue-tsc)。

使用 Codex 辅助完成 AstrBot 对照、代码修改和测试;改动已人工审阅。

@BaizhouziYou
BaizhouziYou self-requested a review November 11, 2026 16:05
@BaizhouziYou
BaizhouziYou merged commit 273ccd8 into main Nov 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants