Skip to content

Commit

Permalink
Merge pull request #176 from simple-robot/dev/main
Browse files Browse the repository at this point in the history
Release: v4.0.2
  • Loading branch information
ForteScarlet authored Aug 29, 2024
2 parents c76df79 + 0f77c57 commit 3ea12ce
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .changelog/v4.0.2.md
Original file line number Diff line number Diff line change
@@ -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),感谢您的贡献与支持!
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 3ea12ce

Please sign in to comment.