mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-09 02:10:10 +08:00
Rename PokeMessage.type to PokeMessage.pokeType
This commit is contained in:
parent
6b792e3ba6
commit
021aac1b56
mirai-core-api/src/commonMain/kotlin/message/data
mirai-core/src/commonMain/kotlin/message
@ -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 = "[戳一戳]"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user