Skip to content

为内部消息相关事件增加一个 target 挂起属性 #1050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 22, 2025

Conversation

ForliyScarlet
Copy link
Member

用于区分 content,来表达消息的发送目标。

see also: #1047

Introduce a `target` function in `InternalMessageInteractionEvent` to determine the message's send destination. Enhance documentation for `InteractionMessage` types, including `@since` annotations for better version tracking and clarity.

Signed-off-by: ForteScarlet <[email protected]>
Introduced a suspendable method `target` across various event interfaces using the `@STP` annotation. This allows direct access to the sending target for improved clarity and consistency in interaction handling.

Signed-off-by: ForteScarlet <[email protected]>
Introduced a standardized `target` method across multiple message event interfaces to retrieve the specific target entity (e.g., `Contact`, `ChatRoom`, `ChatGroup`, `Member`). This ensures access to the appropriate target entity from event content in a consistent and suspendable manner.

Signed-off-by: ForteScarlet <[email protected]>
@ForliyScarlet ForliyScarlet added the 特性 一个新特性,或者一个新的功能/能力 label Apr 22, 2025
@ForteScarlet ForteScarlet enabled auto-merge April 22, 2025 11:09
@ForteScarlet ForteScarlet requested a review from Copilot April 22, 2025 11:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new suspended "target" function on various internal messaging event interfaces to help clearly distinguish the sending target from the content. Key changes include:

  • Adding the suspended "target" function to SendSupport and ReplySupport event interfaces.
  • Updating documentation comments across multiple event interfaces with @stp annotation.
  • Making similar changes in InternalMessageInteractionEvent and InteractionMessage for consistent semantics.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
simbot-api/src/commonMain/kotlin/love/forte/simbot/event/SendSupportInteractionEvent.kt Added target() for SendSupport-based events to return content.
simbot-api/src/commonMain/kotlin/love/forte/simbot/event/ReplySupportInteractionEvent.kt Introduced target() for various ReplySupport-based events using content().
simbot-api/src/commonMain/kotlin/love/forte/simbot/event/InternalMessageInteractionEvent.kt Added target() description and default implementation.
simbot-api/src/commonMain/kotlin/love/forte/simbot/event/InteractionMessage.kt Updated documentation with versioning details.

@ForliyScarlet
Copy link
Member Author

ForliyScarlet commented Apr 22, 2025

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

Signed-off-by: ForteScarlet <[email protected]>
@ForteScarlet ForteScarlet merged commit 197ae8d into v4-dev Apr 22, 2025
6 checks passed
@ForteScarlet ForteScarlet deleted the improve-internal-event-props branch April 22, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
特性 一个新特性,或者一个新的功能/能力
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants