mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-03 07:32:27 +08:00
Fix #220
This commit is contained in:
parent
c6059ab9ec
commit
e1004f12c9
@ -273,13 +273,21 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B
|
|||||||
}
|
}
|
||||||
element.lightApp != null -> {
|
element.lightApp != null -> {
|
||||||
val content = runWithBugReport("解析 lightApp", { element.lightApp.data.toUHexString() }) {
|
val content = runWithBugReport("解析 lightApp", { element.lightApp.data.toUHexString() }) {
|
||||||
MiraiPlatformUtils.unzip(element.lightApp.data, 1).encodeToString()
|
when (element.lightApp.data[0].toInt()) {
|
||||||
|
0 -> element.lightApp.data.encodeToString(offset = 1)
|
||||||
|
1 -> MiraiPlatformUtils.unzip(element.lightApp.data, 1).encodeToString()
|
||||||
|
else -> error("unknown compression flag=${element.lightApp.data[0]}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
message.add(LightApp(content))
|
message.add(LightApp(content))
|
||||||
}
|
}
|
||||||
element.richMsg != null -> {
|
element.richMsg != null -> {
|
||||||
val content = runWithBugReport("解析 richMsg", { element.richMsg.template1.toUHexString() }) {
|
val content = runWithBugReport("解析 richMsg", { element.richMsg.template1.toUHexString() }) {
|
||||||
MiraiPlatformUtils.unzip(element.richMsg.template1, 1).encodeToString()
|
when (element.richMsg.template1[0].toInt()) {
|
||||||
|
0 -> element.richMsg.template1.encodeToString(offset = 1)
|
||||||
|
1 -> MiraiPlatformUtils.unzip(element.richMsg.template1, 1).encodeToString()
|
||||||
|
else -> error("unknown compression flag=${element.richMsg.template1[0]}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
when (element.richMsg.serviceId) {
|
when (element.richMsg.serviceId) {
|
||||||
// 5: 使用微博长图转换功能分享到QQ群
|
// 5: 使用微博长图转换功能分享到QQ群
|
||||||
|
@ -93,7 +93,8 @@ internal fun UByteArray.toUHexString(separator: String = " ", offset: Int = 0, l
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
internal inline fun ByteArray.encodeToString(charset: Charset = Charsets.UTF_8): String = String(this, charset = charset)
|
internal inline fun ByteArray.encodeToString(offset: Int = 0, charset: Charset = Charsets.UTF_8): String =
|
||||||
|
String(this, charset = charset, offset = offset)
|
||||||
|
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal inline fun ByteArray.toReadPacket(offset: Int = 0, length: Int = this.size - offset) =
|
internal inline fun ByteArray.toReadPacket(offset: Int = 0, length: Int = this.size - offset) =
|
||||||
|
Loading…
Reference in New Issue
Block a user