From 517e442f3e88b89b7bd2958830577a81f75dd368 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 29 Aug 2024 22:41:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(core):=20=E4=BF=AE=E5=A4=8D=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E6=8E=A5=E6=94=B6=E7=9A=84=20MessageContent?= =?UTF-8?q?=20=E4=B8=AD,=20`referenceMessage`=20=E7=9A=84=E8=A1=8C?= =?UTF-8?q?=E4=B8=BA=E4=B8=8E=20`reference`=20=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E9=94=99=E8=AF=AF=E5=9C=B0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=87=AA=E8=BA=AB=E6=B6=88=E6=81=AF=E8=AF=A6=E6=83=85=E8=80=8C?= =?UTF-8?q?=E9=9D=9E=E5=BC=95=E7=94=A8=E6=B6=88=E6=81=AF=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kook/message/KookReceiveMessageContent.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/simbot-component-kook-core/src/commonMain/kotlin/love/forte/simbot/component/kook/message/KookReceiveMessageContent.kt b/simbot-component-kook-core/src/commonMain/kotlin/love/forte/simbot/component/kook/message/KookReceiveMessageContent.kt index e486e3e3..65490d06 100644 --- a/simbot-component-kook-core/src/commonMain/kotlin/love/forte/simbot/component/kook/message/KookReceiveMessageContent.kt +++ b/simbot-component-kook-core/src/commonMain/kotlin/love/forte/simbot/component/kook/message/KookReceiveMessageContent.kt @@ -262,9 +262,10 @@ public class KookReceiveMessageContent internal constructor( } } - override suspend fun referenceMessage(): KookMessageContent { + override suspend fun referenceMessage(): KookMessageContent? { return if (isDirect) { - val details = detailsFromDirect(bot, source.msgId, source.authorId) + val ref = referenceFromDirect(bot, source.msgId, source.authorId) ?: return null + val details = detailsFromDirect(bot, ref.quote.id, source.authorId) KookUpdatedMessageContent( bot = bot, isDirect = false, @@ -277,7 +278,8 @@ public class KookReceiveMessageContent internal constructor( isMentionHere = false ) } else { - val details = detailsFromChannel(bot, source.msgId) + val ref = referenceFromChannel(bot, source.msgId) ?: return null + val details = detailsFromChannel(bot, ref.quote.id) details.toContent(bot) } } @@ -344,9 +346,11 @@ public class KookUpdatedMessageContent internal constructor( } @JvmSynthetic - override suspend fun referenceMessage(): KookMessageContent { + override suspend fun referenceMessage(): KookMessageContent? { return if (isDirect) { - val details = detailsFromDirectWithChatCode(bot, msgId, chatCode!!) + val chatCode = chatCode!! + val ref = referenceFromDirectWithChatCode(bot, msgId, chatCode) ?: return null + val details = detailsFromDirectWithChatCode(bot, ref.quote.id, chatCode) KookUpdatedMessageContent( bot = bot, isDirect = false, @@ -359,7 +363,8 @@ public class KookUpdatedMessageContent internal constructor( isMentionHere = false ) } else { - val details = detailsFromChannel(bot, msgId) + val ref = referenceFromChannel(bot, msgId) ?: return null + val details = detailsFromChannel(bot, ref.quote.id) details.toContent(bot) } } From 0f77c57e0cef05c9175e50908d92cd0995d3791d Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 29 Aug 2024 22:54:37 +0800 Subject: [PATCH 2/2] release: v4.0.2 --- .changelog/v4.0.2.md | 4 ++++ CHANGELOG.md | 6 ++++++ buildSrc/src/main/kotlin/P.kt | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changelog/v4.0.2.md diff --git a/.changelog/v4.0.2.md b/.changelog/v4.0.2.md new file mode 100644 index 00000000..5b045d68 --- /dev/null +++ b/.changelog/v4.0.2.md @@ -0,0 +1,4 @@ +> [!note] +> 对应核心版本: [**v4.6.0**](https://github.com/simple-robot/simpler-robot/releases/tag/v4.6.0) + +我们欢迎并期望着您的 [反馈](https://github.com/simple-robot/simbot-component-kook/issues) 或 [协助](https://github.com/simple-robot/simbot-component-kook/pulls),感谢您的贡献与支持! diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b2bc6b5..67c99c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v4.0.2 + +> Release & Pull Notes: [v4.0.2](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.2) + +- fix(core): 修复事件中接收的 MessageContent 中, `referenceMessage` 的行为与 `reference` 不一致,会错误地获取自身消息详情而非引用消息详情的问题 ([`517e442`](https://github.com/simple-robot/simpler-robot/commit/517e442)) + # v4.0.1 > Release & Pull Notes: [v4.0.1](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.1) diff --git a/buildSrc/src/main/kotlin/P.kt b/buildSrc/src/main/kotlin/P.kt index 351625f3..b0e12b0b 100644 --- a/buildSrc/src/main/kotlin/P.kt +++ b/buildSrc/src/main/kotlin/P.kt @@ -32,8 +32,8 @@ object P : ProjectDetail() { override val homepage: String get() = HOMEPAGE - const val VERSION = "4.0.1" - const val NEXT_VERSION = "4.0.2" + const val VERSION = "4.0.2" + const val NEXT_VERSION = "4.0.3" override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT" override val version = if (isSnapshot()) snapshotVersion else VERSION