Skip to content

Conversation

@Aliorpse
Copy link
Contributor

No description provided.

@ForliyScarlet
Copy link
Member

ForliyScarlet commented Sep 14, 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]

Copy link
Member

@ForteScarlet ForteScarlet left a comment

Choose a reason for hiding this comment

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

首先感谢贡献🎉 需要修正一些小细节上的问题,然后尽量针对这两个API,对它们的功能进行更多测试(更多测试指不止「文本」消息,尽量多测试几个组合,比如图片和嵌套的和并转发等)。
测试不需要提交到PR的代码里,你本地能测通、然后说一声就行,可以提供测试用的代码,后续我给它们补充测试的时候可以用上。

然后记得确保 gradle apiCheckgradle detekt 检测均可通过。稍后开启 workflow 的时候也会测,防止到时候有问题又要再改。

@Aliorpse
Copy link
Contributor Author

gradle 测试是能过的。我在我自己的应用中尝试了图片混合文本,图片混合文本加视频的组合。可以使用。
buildMessages如下

buildMessages {
        +OneBotForwardNode.create(
            userId = 114514.ID,
            nickname = "user",
            content = listOf(
                OneBotImage.create(URI.create(url).toResource()),
                OneBotText.create(
                    buildString {
                        append("textUnderImage")
                    }
                )
            )
        ).toElement()

        +OneBotForwardNode.create(
            userId = 114514.ID,
            nickname = "user",
            content = listOf(
                OneBotVideo.create(video.toResource())
            )
        ).toElement()
    }

但是貌似不能在OneBotForwardNode.create中再次嵌套一个OneBotForwardNode,转发时会直接无视掉。
例如这样

buildMessages {  
    +OneBotForwardNode.create(  
        userId = 114514.ID,  
        nickname = "外层转发",  
        content = listOf(  
            OneBotText.create("外层消息内容"),  
            OneBotForwardNode.create(  
                userId = 114514.ID,  
                nickname = "内层转发",
                content = listOf(  
                    OneBotText.create("内层消息内容")
                )
            )
        )
    ).toElement()
}

我不知道我是不是写错了()

Copy link
Contributor

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 adds non-standard forward message APIs to the OneBot v11 component, enabling the sending of forward messages in both private chats and group chats.

Key changes:

  • Add support for non-standard forward message APIs (send_private_forward_msg and send_group_forward_msg)
  • Export the new nonstandard API package in the module definition
  • Minor documentation format standardization for existing private message API

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
module-info.java Exports the new nonstandard API package to make it available to other modules
SendPrivateForwardMsgApi.kt Implements the non-standard API for sending private forward messages
SendGroupForwardMsgApi.kt Implements the non-standard API for sending group forward messages with custom result type
SendPrivateMsgApi.kt Updates documentation format to use backticks for consistency
OneBotFriend.kt Removes trailing whitespace

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Aliorpse
Copy link
Contributor Author

这怎么还有个api(

@ForteScarlet ForteScarlet enabled auto-merge (squash) September 14, 2025 05:55
@ForteScarlet ForteScarlet merged commit d941160 into simple-robot:dev/main Sep 14, 2025
4 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.

3 participants