fix: fetch_emoji_like 兼容 LLBot#119
Conversation
LLBot 的 fetch_emoji_like 使用 snake_case 参数名 (emoji_id), 而 NapCat 使用 camelCase (emojiId)。当前代码只传了 emojiId, 导致 LLBot 因缺少必需参数 emoji_id 而验证失败,异常被静默捕获, 仲裁机制完全失效——所有 Bot 都认为自己胜出,重复解析。 同时传递两种参数名,各实现取所需、忽略未知参数。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
审阅者指南(在小型 PR 上折叠)审阅者指南调整 EmojiLikeArbiter 的 _fetch_users,使其在调用 fetch_emoji_like 时同时传递 snake_case 和 camelCase 参数(以及显式的 count),以便同时兼容 LLBot 和 NapCat 的实现,从而恢复正确的仲裁行为。 EmojiLikeArbiter _fetch_users 调用 fetch_emoji_like 的时序图sequenceDiagram
participant EmojiLikeArbiter
participant Bot
participant Platform
EmojiLikeArbiter->>Bot: fetch_emoji_like(message_id, emoji_id, emojiId, emojiType, count)
Note over EmojiLikeArbiter,Bot: Both snake_case and camelCase params are sent
alt NapCat implementation
Bot->>Platform: fetch_emoji_like(message_id, emojiId, emojiType, count)
Platform-->>Bot: emoji_like_users
Bot-->>EmojiLikeArbiter: emoji_like_users
else LLBot implementation
Bot->>Platform: fetch_emoji_like(message_id, emoji_id, count)
Platform-->>Bot: emoji_like_users
Bot-->>EmojiLikeArbiter: emoji_like_users
end
EmojiLikeArbiter->>EmojiLikeArbiter: use emoji_like_users for arbitration
EmojiLikeArbiter _fetch_users 参数变更的类图classDiagram
class EmojiLikeArbiter {
+_fetch_users(bot, message_id, emoji_id, emoji_type) async
}
class Bot {
+fetch_emoji_like(message_id, emoji_id, emojiId, emojiType, count) async
}
EmojiLikeArbiter --> Bot : uses
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验前往你的 控制面板 来:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts EmojiLikeArbiter’s _fetch_users to pass both snake_case and camelCase parameters (and an explicit count) to fetch_emoji_like so it works with both LLBot and NapCat implementations, restoring proper arbitration behavior. Sequence diagram for EmojiLikeArbiter _fetch_users calling fetch_emoji_likesequenceDiagram
participant EmojiLikeArbiter
participant Bot
participant Platform
EmojiLikeArbiter->>Bot: fetch_emoji_like(message_id, emoji_id, emojiId, emojiType, count)
Note over EmojiLikeArbiter,Bot: Both snake_case and camelCase params are sent
alt NapCat implementation
Bot->>Platform: fetch_emoji_like(message_id, emojiId, emojiType, count)
Platform-->>Bot: emoji_like_users
Bot-->>EmojiLikeArbiter: emoji_like_users
else LLBot implementation
Bot->>Platform: fetch_emoji_like(message_id, emoji_id, count)
Platform-->>Bot: emoji_like_users
Bot-->>EmojiLikeArbiter: emoji_like_users
end
EmojiLikeArbiter->>EmojiLikeArbiter: use emoji_like_users for arbitration
Class diagram for EmojiLikeArbiter _fetch_users parameter changesclassDiagram
class EmojiLikeArbiter {
+_fetch_users(bot, message_id, emoji_id, emoji_type) async
}
class Bot {
+fetch_emoji_like(message_id, emoji_id, emojiId, emojiType, count) async
}
EmojiLikeArbiter --> Bot : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我在这里给出一些整体性的反馈:
- 捕获一个宽泛的
Exception并返回空列表会让调试失败变得困难;建议至少记录(log)异常,或者收窄要捕获的异常类型,这样意外的 schema 变更可以更明显地暴露出来。 - 目前 LLBot/NapCat 的兼容分支是通过双参数名以内联方式编码的;建议把这部分兼容逻辑抽取出来(例如封装到一个 helper 或 adapter 中),这样未来的 OneBot 实现或参数变更可以在一个集中位置处理,而不是让协议细节散落在 arbiter 的各处。
AI Agent 提示词
Please address the comments from this code review:
## Overall Comments
- Catching a broad `Exception` and returning an empty list makes debugging failures difficult; consider at least logging the exception or narrowing the exception types so unexpected schema changes surface more visibly.
- The LLBot/NapCat compatibility branching is currently encoded inline via dual parameter names; consider encapsulating this compatibility logic (e.g., in a helper or adapter) so future OneBot implementations or parameter changes can be handled in a single place instead of scattering protocol quirks through the arbiter.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的 Review。
Original comment in English
Hey - I've left some high level feedback:
- Catching a broad
Exceptionand returning an empty list makes debugging failures difficult; consider at least logging the exception or narrowing the exception types so unexpected schema changes surface more visibly. - The LLBot/NapCat compatibility branching is currently encoded inline via dual parameter names; consider encapsulating this compatibility logic (e.g., in a helper or adapter) so future OneBot implementations or parameter changes can be handled in a single place instead of scattering protocol quirks through the arbiter.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Catching a broad `Exception` and returning an empty list makes debugging failures difficult; consider at least logging the exception or narrowing the exception types so unexpected schema changes surface more visibly.
- The LLBot/NapCat compatibility branching is currently encoded inline via dual parameter names; consider encapsulating this compatibility logic (e.g., in a helper or adapter) so future OneBot implementations or parameter changes can be handled in a single place instead of scattering protocol quirks through the arbiter.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR fixes EmojiLikeArbiter compatibility with LLBot by aligning the fetch_emoji_like request payload with both supported parameter naming styles, so the existing cross-bot arbitration logic works consistently on aiocqhttp-based QQ bot implementations.
Changes:
- Update
fetch_emoji_likecalls to send bothemoji_idandemojiIdso LLBot and NapCat can each accept the field they expect. - Add an explicit
count=20parameter to the emoji-like fetch request. - Keep the arbiter’s existing behavior unchanged aside from restoring compatibility for LLBot-backed bots.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
问题
仲裁器 (
EmojiLikeArbiter) 的fetch_emoji_like调用使用了 NapCat 风格的 camelCase 参数名 (emojiId),但 LLBot (LuckyLilliaBot) 的fetch_emoji_like使用 snake_case 参数名 (emoji_id)。LLBot 的 payload schema (源码):
当 Bot 通过 LLBot 连接时,
emoji_id缺失导致 schema 验证失败,异常被except Exception静默捕获,_fetch_users始终返回空列表。结果:仲裁完全失效,所有 Bot 都认为自己胜出,重复解析同一链接。set_msg_emoji_like不受影响(NapCat 和 LLBot 都接受emoji_id)。修复
同时传递两种参数名(
emoji_id+emojiId),各实现取所需、忽略未知参数:验证
Summary by Sourcery
Bug Fixes:
fetch_emoji_like参数名称不匹配,导致在使用 LLBot 时表情符号类似仲裁失败的问题。Original summary in English
Summary by Sourcery
Bug Fixes: