🐛 Incorrect structure of emoji details (likes) in MessageEmojiLikeNoticeEvent; Message blocking was not working perfectly.#343
Merged
Conversation
…iceEvent; Message blocking was not working perfectly.
审阅者指南此拉取请求(PR)通过引入嵌套的 更新后的消息阻塞流程序列图(消息事件处理)sequenceDiagram
participant Bot
participant EventUtils
participant InjectionHandler
participant Plugin
participant Interceptor
Bot->>EventUtils: pushAnyMessageEvent()
EventUtils->>InjectionHandler: invokeAnyMessage()
InjectionHandler-->>EventUtils: returns boolean (blocked?)
alt Message blocked
EventUtils-->>Bot: returns true
else Not blocked
EventUtils->>Plugin: onAnyMessage()
Plugin-->>EventUtils: returns MESSAGE_BLOCK or not
alt Plugin blocks
EventUtils-->>Bot: returns true
else Not blocked
EventUtils-->>Bot: returns false
end
end
Bot->>Interceptor: afterCompletion()
更新后的
|
| 更改 | 详情 | 文件 |
|---|---|---|
| 将表情符号点赞详情重构为嵌套对象 |
|
src/main/java/com/mikuac/shiro/dto/event/notice/MessageEmojiLikeNoticeEvent.java |
| 将注入方法转换为返回阻塞状态 |
|
src/main/java/com/mikuac/shiro/handler/injection/InjectionHandler.java |
在 MessageEvent 处理中添加阻塞检查 |
|
src/main/java/com/mikuac/shiro/handler/event/MessageEvent.java |
重构 pushAnyMessageEvent 以返回阻塞指示 |
|
src/main/java/com/mikuac/shiro/common/utils/EventUtils.java |
修正 GroupMessageReactionNoticeEvent 中的 Javadoc |
|
src/main/java/com/mikuac/shiro/dto/event/notice/GroupMessageReactionNoticeEvent.java |
提示和命令
与 Sourcery 互动
- 触发新审阅: 在拉取请求上评论
@sourcery-ai review。 - 继续讨论: 直接回复 Sourcery 的审阅评论。
- 从审阅评论生成 GitHub issue: 通过回复审阅评论,要求 Sourcery 从中创建一个 issue。您也可以回复审阅评论并带上
@sourcery-ai issue来创建 issue。 - 生成拉取请求标题: 随时在拉取请求标题的任意位置写入
@sourcery-ai来生成标题。您也可以在拉取请求上评论@sourcery-ai title来随时(重新)生成标题。 - 生成拉取请求摘要: 随时在拉取请求正文的任意位置写入
@sourcery-ai summary,以在您希望的位置生成 PR 摘要。您也可以在拉取请求上评论@sourcery-ai summary来随时(重新)生成摘要。 - 生成审阅者指南: 在拉取请求上评论
@sourcery-ai guide来随时(重新)生成审阅者指南。 - 解决所有 Sourcery 评论: 在拉取请求上评论
@sourcery-ai resolve来解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这会很有用。 - 驳回所有 Sourcery 审阅: 在拉取请求上评论
@sourcery-ai dismiss来驳回所有现有 Sourcery 审阅。如果您想从头开始新的审阅,这尤其有用——别忘了评论@sourcery-ai review来触发新的审阅!
自定义您的体验
访问您的仪表板以:
- 启用或禁用审阅功能,例如 Sourcery 生成的拉取请求摘要、审阅者指南等。
- 更改审阅语言。
- 添加、删除或编辑自定义审阅说明。
- 调整其他审阅设置。
获取帮助
Original review guide in English
Reviewer's Guide
This PR restructures the emoji like event JSON mapping by introducing a nested Likes class and refines the message processing pipeline to fully support blocking by converting handler methods to return booleans and adding control‐flow checks, plus it corrects documentation in the reaction event DTO.
Sequence diagram for updated message blocking flow in message event processing
sequenceDiagram
participant Bot
participant EventUtils
participant InjectionHandler
participant Plugin
participant Interceptor
Bot->>EventUtils: pushAnyMessageEvent()
EventUtils->>InjectionHandler: invokeAnyMessage()
InjectionHandler-->>EventUtils: returns boolean (blocked?)
alt Message blocked
EventUtils-->>Bot: returns true
else Not blocked
EventUtils->>Plugin: onAnyMessage()
Plugin-->>EventUtils: returns MESSAGE_BLOCK or not
alt Plugin blocks
EventUtils-->>Bot: returns true
else Not blocked
EventUtils-->>Bot: returns false
end
end
Bot->>Interceptor: afterCompletion()
Class diagram for updated MessageEmojiLikeNoticeEvent structure
classDiagram
class MessageEmojiLikeNoticeEvent {
Long operatorId
Likes likes
}
class Likes {
String emojiId
Integer count
}
MessageEmojiLikeNoticeEvent --> Likes
Class diagram for updated message handler method signatures
classDiagram
class InjectionHandler {
boolean invokeAnyMessage(Bot, AnyMessageEvent)
boolean invokeGuildMessage(Bot, GuildMessageEvent)
boolean invokeGroupMessage(Bot, GroupMessageEvent)
boolean invokePrivateMessage(Bot, PrivateMessageEvent)
boolean invokeMessage(Bot, MessageEvent, Optional<List<HandlerMethod>>)
}
InjectionHandler --> Bot
InjectionHandler --> AnyMessageEvent
InjectionHandler --> GuildMessageEvent
InjectionHandler --> GroupMessageEvent
InjectionHandler --> PrivateMessageEvent
InjectionHandler --> MessageEvent
InjectionHandler --> HandlerMethod
Class diagram for updated EventUtils.pushAnyMessageEvent method
classDiagram
class EventUtils {
boolean pushAnyMessageEvent(Bot, JsonObjectWrapper, List<ArrayMsg>)
}
EventUtils --> Bot
EventUtils --> JsonObjectWrapper
EventUtils --> ArrayMsg
Class diagram for corrected GroupMessageReactionNoticeEvent documentation
classDiagram
class GroupMessageReactionNoticeEvent {
String subType
String code "表情ID"
Integer count "表情数量"
}
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Restructure emoji like details into nested object |
|
src/main/java/com/mikuac/shiro/dto/event/notice/MessageEmojiLikeNoticeEvent.java |
| Convert injection methods to return blocking status |
|
src/main/java/com/mikuac/shiro/handler/injection/InjectionHandler.java |
| Add blocking checks in MessageEvent processing |
|
src/main/java/com/mikuac/shiro/handler/event/MessageEvent.java |
| Refactor pushAnyMessageEvent to return block indication |
|
src/main/java/com/mikuac/shiro/common/utils/EventUtils.java |
| Correct Javadoc in GroupMessageReactionNoticeEvent |
|
src/main/java/com/mikuac/shiro/dto/event/notice/GroupMessageReactionNoticeEvent.java |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summaryon the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
There was a problem hiding this comment.
你好 - 我已审阅了你的更改 - 这里有一些反馈:
- 在 MessageEvent.process 中,bot.getPluginList().stream().anyMatch(...) 调用没有重新分配给 messageBlocked,因此插件 MESSAGE_BLOCK 信号实际上不会停止进一步处理 — 捕获并传播该结果。
- MessageEvent.process 中私聊/群聊/公会消息处理存在大量重复 — 考虑将通用的 push/invoke/plugin 逻辑提取到一个共享的帮助器中以提高可维护性。
- 在使用嵌套的 Likes 类重构 MessageEmojiLikeNoticeEvent 后,请仔细检查所有期望 'code' 和 'count' 的序列化器和客户端是否已更新或别名以实现向后兼容性。
供 AI 代理的提示
请解决此代码审查中的注释:
## 总体评论
- 在 MessageEvent.process 中,bot.getPluginList().stream().anyMatch(...) 调用没有重新分配给 messageBlocked,因此插件 MESSAGE_BLOCK 信号实际上不会停止进一步处理 — 捕获并传播该结果。
- MessageEvent.process 中私聊/群聊/公会消息处理存在大量重复 — 考虑将通用的 push/invoke/plugin 逻辑提取到一个共享的帮助器中以提高可维护性。
- 在使用嵌套的 Likes 类重构 MessageEmojiLikeNoticeEvent 后,请仔细检查所有期望 'code' 和 'count' 的序列化器和客户端是否已更新或别名以实现向后兼容性。Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Original comment in English
Hey there - I've reviewed your changes - here's some feedback:
- In MessageEvent.process, the bot.getPluginList().stream().anyMatch(...) calls aren’t assigned back to messageBlocked, so plugin MESSAGE_BLOCK signals won’t actually halt further processing — capture and propagate that result.
- There’s significant duplication in the private/group/guild message handling in MessageEvent.process — consider extracting the common push/invoke/plugin logic into a shared helper to improve maintainability.
- After restructuring MessageEmojiLikeNoticeEvent with the nested Likes class, double-check that all serializers and clients expecting 'code' and 'count' are updated or aliased for backward compatibility.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In MessageEvent.process, the bot.getPluginList().stream().anyMatch(...) calls aren’t assigned back to messageBlocked, so plugin MESSAGE_BLOCK signals won’t actually halt further processing — capture and propagate that result.
- There’s significant duplication in the private/group/guild message handling in MessageEvent.process — consider extracting the common push/invoke/plugin logic into a shared helper to improve maintainability.
- After restructuring MessageEmojiLikeNoticeEvent with the nested Likes class, double-check that all serializers and clients expecting 'code' and 'count' are updated or aliased for backward compatibility.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sourcery 总结
修复 MessageEmojiLikeNoticeEvent 中的表情符号详细结构,并通过重构处理程序调用方法以支持可中断的事件处理来改进消息阻塞功能。
Bug 修复:
改进:
Original summary in English
Summary by Sourcery
Fix emoji detail structure in MessageEmojiLikeNoticeEvent and improve message blocking functionality by refactoring handler invocation methods to support interruptible event processing.
Bug Fixes:
Enhancements: