mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 06:30:13 +08:00
Fix build
This commit is contained in:
parent
0a928407e7
commit
0af6639e9d
@ -1,11 +1,6 @@
|
||||
package net.mamoe.mirai.qqandroid.message
|
||||
@file:Suppress("DEPRECATION_ERROR")
|
||||
|
||||
import net.mamoe.mirai.message.data.FriendFlashImage
|
||||
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
|
||||
package net.mamoe.mirai.qqandroid.message
|
||||
|
||||
|
||||
internal fun GroupFlashImage.toJceData() = ImMsgBody.Elem(
|
||||
|
@ -7,7 +7,7 @@
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
@file:OptIn(LowLevelAPI::class)
|
||||
@file:Suppress("EXPERIMENTAL_API_USAGE")
|
||||
@file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR")
|
||||
|
||||
package net.mamoe.mirai.qqandroid.message
|
||||
|
||||
@ -100,10 +100,12 @@ internal fun MessageChain.toRichTextElems(forGroup: Boolean, withGeneralFlags: B
|
||||
is CustomMessage -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
elements.add(
|
||||
ImMsgBody.Elem(customElem = ImMsgBody.CustomElem(
|
||||
enumType = MIRAI_CUSTOM_ELEM_TYPE,
|
||||
data = CustomMessage.serialize(it.getFactory() as CustomMessage.Factory<CustomMessage>, it)
|
||||
))
|
||||
ImMsgBody.Elem(
|
||||
customElem = ImMsgBody.CustomElem(
|
||||
enumType = MIRAI_CUSTOM_ELEM_TYPE,
|
||||
data = CustomMessage.dump(it.getFactory() as CustomMessage.Factory<CustomMessage>, it)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
is At -> {
|
||||
@ -388,18 +390,22 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B
|
||||
element.customElem != null -> {
|
||||
element.customElem.data.read {
|
||||
kotlin.runCatching {
|
||||
CustomMessage.deserialize(this)
|
||||
CustomMessage.load(this)
|
||||
}.fold(
|
||||
onFailure = {
|
||||
if (it is CustomMessage.Key.CustomMessageFullDataDeserializeInternalException) {
|
||||
bot.logger.error("Internal error: " +
|
||||
"exception while deserializing CustomMessage head data," +
|
||||
" data=${element.customElem.data.toUHexString()}", it)
|
||||
bot.logger.error(
|
||||
"Internal error: " +
|
||||
"exception while deserializing CustomMessage head data," +
|
||||
" data=${element.customElem.data.toUHexString()}", it
|
||||
)
|
||||
} else {
|
||||
it as CustomMessage.Key.CustomMessageFullDataDeserializeUserException
|
||||
bot.logger.error("User error: " +
|
||||
"exception while deserializing CustomMessage body," +
|
||||
" body=${it.body.toUHexString()}", it)
|
||||
bot.logger.error(
|
||||
"User error: " +
|
||||
"exception while deserializing CustomMessage body," +
|
||||
" body=${it.body.toUHexString()}", it
|
||||
)
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -7,7 +7,7 @@
|
||||
* 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:JvmName("Utils")
|
||||
|
||||
@ -49,6 +49,7 @@ internal fun List<Byte>.toUHexString(separator: String = " ", offset: Int = 0, l
|
||||
}
|
||||
}
|
||||
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@JvmOverloads
|
||||
@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 {
|
||||
|
@ -48,7 +48,7 @@ private constructor(
|
||||
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
|
||||
|
||||
companion object Key : Message.Key<At> {
|
||||
|
@ -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 contentToString(): String = "[戳一戳]"
|
||||
@ -163,7 +163,11 @@ data class VipFace internal constructor(
|
||||
data class Kind(
|
||||
val id: Int,
|
||||
val name: String
|
||||
)
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return "($id,$name)"
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION_ERROR", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
companion object : Message.Key<VipFace> {
|
||||
|
Loading…
Reference in New Issue
Block a user