Commit 0af6639e authored by Him188's avatar Him188

Fix build

parent 0a928407
package net.mamoe.mirai.qqandroid.message @file:Suppress("DEPRECATION_ERROR")
import net.mamoe.mirai.message.data.FriendFlashImage package net.mamoe.mirai.qqandroid.message
import net.mamoe.mirai.message.data.GroupFlashImage
import net.mamoe.mirai.message.data.md5
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.HummerCommelem
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray
internal fun GroupFlashImage.toJceData() = ImMsgBody.Elem( internal fun GroupFlashImage.toJceData() = ImMsgBody.Elem(
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:OptIn(LowLevelAPI::class) @file:OptIn(LowLevelAPI::class)
@file:Suppress("EXPERIMENTAL_API_USAGE") @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR")
package net.mamoe.mirai.qqandroid.message package net.mamoe.mirai.qqandroid.message
...@@ -100,10 +100,12 @@ internal fun MessageChain.toRichTextElems(forGroup: Boolean, withGeneralFlags: B ...@@ -100,10 +100,12 @@ internal fun MessageChain.toRichTextElems(forGroup: Boolean, withGeneralFlags: B
is CustomMessage -> { is CustomMessage -> {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
elements.add( elements.add(
ImMsgBody.Elem(customElem = ImMsgBody.CustomElem( ImMsgBody.Elem(
enumType = MIRAI_CUSTOM_ELEM_TYPE, customElem = ImMsgBody.CustomElem(
data = CustomMessage.serialize(it.getFactory() as CustomMessage.Factory<CustomMessage>, it) enumType = MIRAI_CUSTOM_ELEM_TYPE,
)) data = CustomMessage.dump(it.getFactory() as CustomMessage.Factory<CustomMessage>, it)
)
)
) )
} }
is At -> { is At -> {
...@@ -388,18 +390,22 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B ...@@ -388,18 +390,22 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B
element.customElem != null -> { element.customElem != null -> {
element.customElem.data.read { element.customElem.data.read {
kotlin.runCatching { kotlin.runCatching {
CustomMessage.deserialize(this) CustomMessage.load(this)
}.fold( }.fold(
onFailure = { onFailure = {
if (it is CustomMessage.Key.CustomMessageFullDataDeserializeInternalException) { if (it is CustomMessage.Key.CustomMessageFullDataDeserializeInternalException) {
bot.logger.error("Internal error: " + bot.logger.error(
"exception while deserializing CustomMessage head data," + "Internal error: " +
" data=${element.customElem.data.toUHexString()}", it) "exception while deserializing CustomMessage head data," +
" data=${element.customElem.data.toUHexString()}", it
)
} else { } else {
it as CustomMessage.Key.CustomMessageFullDataDeserializeUserException it as CustomMessage.Key.CustomMessageFullDataDeserializeUserException
bot.logger.error("User error: " + bot.logger.error(
"exception while deserializing CustomMessage body," + "User error: " +
" body=${it.body.toUHexString()}", it) "exception while deserializing CustomMessage body," +
" body=${it.body.toUHexString()}", it
)
} }
}, },
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "NOTHING_TO_INLINE") @file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "NOTHING_TO_INLINE", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@file:JvmMultifileClass @file:JvmMultifileClass
@file:JvmName("Utils") @file:JvmName("Utils")
...@@ -49,6 +49,7 @@ internal fun List<Byte>.toUHexString(separator: String = " ", offset: Int = 0, l ...@@ -49,6 +49,7 @@ internal fun List<Byte>.toUHexString(separator: String = " ", offset: Int = 0, l
} }
} }
@kotlin.internal.LowPriorityInOverloadResolution
@JvmOverloads @JvmOverloads
@Suppress("DuplicatedCode") // false positive. foreach is not common to UByteArray and ByteArray @Suppress("DuplicatedCode") // false positive. foreach is not common to UByteArray and ByteArray
internal fun ByteArray.toUHexString(separator: String = " ", offset: Int = 0, length: Int = this.size - offset): String { internal fun ByteArray.toUHexString(separator: String = " ", offset: Int = 0, length: Int = this.size - offset): String {
......
...@@ -48,7 +48,7 @@ private constructor( ...@@ -48,7 +48,7 @@ private constructor(
return other is At && other.target == this.target && other.display == this.display return other is At && other.target == this.target && other.display == this.display
} }
override fun toString(): String = "[mirai:at:$target]" override fun toString(): String = "[mirai:at:$target,$display]"
override fun contentToString(): String = this.display override fun contentToString(): String = this.display
companion object Key : Message.Key<At> { companion object Key : Message.Key<At> {
......
...@@ -132,7 +132,7 @@ data class PokeMessage internal constructor( ...@@ -132,7 +132,7 @@ data class PokeMessage internal constructor(
} }
private val stringValue = "[mirai:poke:$type,$id]" private val stringValue = "[mirai:poke:$name,$type,$id]"
override fun toString(): String = stringValue override fun toString(): String = stringValue
override fun contentToString(): String = "[戳一戳]" override fun contentToString(): String = "[戳一戳]"
...@@ -163,7 +163,11 @@ data class VipFace internal constructor( ...@@ -163,7 +163,11 @@ data class VipFace internal constructor(
data class Kind( data class Kind(
val id: Int, val id: Int,
val name: String val name: String
) ) {
override fun toString(): String {
return "($id,$name)"
}
}
@Suppress("DEPRECATION_ERROR", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @Suppress("DEPRECATION_ERROR", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
companion object : Message.Key<VipFace> { companion object : Message.Key<VipFace> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment