diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt index eb745d75a..88b5c7585 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt @@ -41,7 +41,7 @@ public sealed class HummerMessage : MessageContent, ConstrainSingle { * 戳一戳. 可以发送给好友或群. * * ## mirai 码支持 - * 格式: [mirai:poke:*[name]*,*[type]*,*[id]*] + * 格式: [mirai:poke:*[name]*,*[pokeType]*,*[id]*] * * @see PokeMessage.Companion 使用伴生对象中的常量 */ @@ -52,7 +52,7 @@ public data class PokeMessage internal constructor( */ public val name: String, - public val type: Int, + public val pokeType: Int, // 'type' is used by serialization public val id: Int ) : HummerMessage(), CodableMessage { @ExperimentalMessageKey @@ -163,7 +163,7 @@ public data class PokeMessage internal constructor( } - private val stringValue = "[mirai:poke:$name,$type,$id]" + private val stringValue = "[mirai:poke:$name,$pokeType,$id]" override fun toString(): String = stringValue override fun contentToString(): String = "[戳一戳]" diff --git a/mirai-core/src/commonMain/kotlin/message/conversions.kt b/mirai-core/src/commonMain/kotlin/message/conversions.kt index 99add52cd..fc6605b39 100644 --- a/mirai-core/src/commonMain/kotlin/message/conversions.kt +++ b/mirai-core/src/commonMain/kotlin/message/conversions.kt @@ -122,9 +122,9 @@ internal fun MessageChain.toRichTextElems(forGroup: Boolean, withGeneralFlags: B ImMsgBody.Elem( commonElem = ImMsgBody.CommonElem( serviceType = 2, - businessType = it.type, + businessType = it.pokeType, pbElem = HummerCommelem.MsgElemInfoServtype2( - pokeType = it.type, + pokeType = it.pokeType, vaspokeId = it.id, vaspokeMinver = "7.2.0", vaspokeName = it.name @@ -461,7 +461,7 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, botId: val proto = element.commonElem.pbElem.loadAs(HummerCommelem.MsgElemInfoServtype2.serializer()) list.add(PokeMessage( proto.vaspokeName.takeIf { it.isNotEmpty() } - ?: PokeMessage.values.firstOrNull { it.id == proto.vaspokeId && it.type == proto.pokeType }?.name + ?: PokeMessage.values.firstOrNull { it.id == proto.vaspokeId && it.pokeType == proto.pokeType }?.name .orEmpty(), proto.pokeType, proto.vaspokeId