mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-08 22:09:50 +08:00
Support more poke messages
This commit is contained in:
parent
3c98151f87
commit
128125eec7
@ -120,7 +120,9 @@ internal fun MessageChain.toRichTextElems(forGroup: Boolean, withGeneralFlags: B
|
||||
businessType = it.type,
|
||||
pbElem = HummerCommelem.MsgElemInfoServtype2(
|
||||
pokeType = it.type,
|
||||
vaspokeId = it.id
|
||||
vaspokeId = it.id,
|
||||
vaspokeMinver = "7.2.0",
|
||||
vaspokeName = it.name
|
||||
).toByteArray(HummerCommelem.MsgElemInfoServtype2.serializer())
|
||||
)
|
||||
)
|
||||
@ -383,7 +385,13 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B
|
||||
when (element.commonElem.serviceType) {
|
||||
2 -> {
|
||||
val proto = element.commonElem.pbElem.loadAs(HummerCommelem.MsgElemInfoServtype2.serializer())
|
||||
list.add(PokeMessage(proto.pokeType, proto.vaspokeId))
|
||||
list.add(PokeMessage(
|
||||
proto.vaspokeName.takeIf { it.isNotEmpty() }
|
||||
?: PokeMessage.values.firstOrNull { it.id == proto.vaspokeId && it.type == proto.pokeType }?.name
|
||||
.orEmpty(),
|
||||
proto.pokeType,
|
||||
proto.vaspokeId
|
||||
))
|
||||
}
|
||||
3 -> {
|
||||
val proto = element.commonElem.pbElem.loadAs(HummerCommelem.MsgElemInfoServtype3.serializer())
|
||||
|
@ -17,7 +17,7 @@ import kotlin.jvm.JvmField
|
||||
|
||||
internal class HummerCommelem : ProtoBuf {
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype1(
|
||||
internal class MsgElemInfoServtype1(
|
||||
@ProtoId(1) @JvmField val rewardId: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val senderUin: Long = 0L,
|
||||
@ProtoId(3) @JvmField val picType: Int = 0,
|
||||
@ -33,7 +33,7 @@ internal class MsgElemInfoServtype1(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype11(
|
||||
internal class MsgElemInfoServtype11(
|
||||
@ProtoId(1) @JvmField val resID: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val resMD5: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(3) @JvmField val reserveInfo1: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ -45,19 +45,19 @@ internal class MsgElemInfoServtype11(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype13(
|
||||
internal class MsgElemInfoServtype13(
|
||||
@ProtoId(1) @JvmField val sysHeadId: Int = 0,
|
||||
@ProtoId(2) @JvmField val headFlag: Int = 0
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype14(
|
||||
internal class MsgElemInfoServtype14(
|
||||
@ProtoId(1) @JvmField val id: Int = 0,
|
||||
@ProtoId(2) @JvmField val reserveInfo: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype15(
|
||||
internal class MsgElemInfoServtype15(
|
||||
@ProtoId(1) @JvmField val vid: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val cover: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(3) @JvmField val title: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ -69,7 +69,7 @@ internal class MsgElemInfoServtype15(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype16(
|
||||
internal class MsgElemInfoServtype16(
|
||||
@ProtoId(1) @JvmField val uid: Long = 0L,
|
||||
@ProtoId(2) @JvmField val unionID: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(3) @JvmField val storyID: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ -85,7 +85,7 @@ internal class MsgElemInfoServtype16(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype18(
|
||||
internal class MsgElemInfoServtype18(
|
||||
@ProtoId(1) @JvmField val currentAmount: Long = 0L,
|
||||
@ProtoId(2) @JvmField val totalAmount: Long = 0L,
|
||||
@ProtoId(3) @JvmField val listid: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ -94,18 +94,18 @@ internal class MsgElemInfoServtype18(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype19(
|
||||
internal class MsgElemInfoServtype19(
|
||||
@ProtoId(1) @JvmField val data: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype2(
|
||||
internal class MsgElemInfoServtype2(
|
||||
@ProtoId(1) @JvmField val pokeType: Int = 0,
|
||||
@ProtoId(2) @JvmField val pokeSummary: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val pokeSummary: String = "",
|
||||
@ProtoId(3) @JvmField val doubleHit: Int = 0,
|
||||
@ProtoId(4) @JvmField val vaspokeId: Int = 0,
|
||||
@ProtoId(5) @JvmField val vaspokeName: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(6) @JvmField val vaspokeMinver: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(5) @JvmField val vaspokeName: String = "",
|
||||
@ProtoId(6) @JvmField val vaspokeMinver: String = "",
|
||||
@ProtoId(7) @JvmField val pokeStrength: Int = 0,
|
||||
@ProtoId(8) @JvmField val msgType: Int = 0,
|
||||
@ProtoId(9) @JvmField val faceBubbleCount: Int = 0,
|
||||
@ -113,25 +113,25 @@ internal class MsgElemInfoServtype2(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype20(
|
||||
internal class MsgElemInfoServtype20(
|
||||
@ProtoId(1) @JvmField val data: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype21(
|
||||
internal class MsgElemInfoServtype21(
|
||||
@ProtoId(1) @JvmField val topicId: Int = 0,
|
||||
@ProtoId(2) @JvmField val confessorUin: Long = 0L,
|
||||
@ProtoId(3) @JvmField val confessorNick: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(4) @JvmField val confessorSex: Int = 0,
|
||||
@ProtoId(5) @JvmField val sysmsgFlag: Int = 0,
|
||||
@ProtoId(6) @JvmField val c2cConfessCtx: HummerCommelem.MsgElemInfoServtype21.C2CConfessContext? = null,
|
||||
@ProtoId(6) @JvmField val c2cConfessCtx: C2CConfessContext? = null,
|
||||
@ProtoId(7) @JvmField val topic: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(8) @JvmField val confessTime: Long = 0L,
|
||||
@ProtoId(9) @JvmField val groupConfessMsg: HummerCommelem.MsgElemInfoServtype21.GroupConfessMsg? = null,
|
||||
@ProtoId(10) @JvmField val groupConfessCtx: HummerCommelem.MsgElemInfoServtype21.GroupConfessContext? = null
|
||||
@ProtoId(9) @JvmField val groupConfessMsg: GroupConfessMsg? = null,
|
||||
@ProtoId(10) @JvmField val groupConfessCtx: GroupConfessContext? = null
|
||||
) : ProtoBuf {
|
||||
@Serializable
|
||||
internal class C2CConfessContext(
|
||||
internal class C2CConfessContext(
|
||||
@ProtoId(1) @JvmField val confessorUin: Long = 0L,
|
||||
@ProtoId(2) @JvmField val confessToUin: Long = 0L,
|
||||
@ProtoId(3) @JvmField val sendUin: Long = 0L,
|
||||
@ -147,7 +147,7 @@ internal class C2CConfessContext(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class GroupConfessContext(
|
||||
internal class GroupConfessContext(
|
||||
@ProtoId(1) @JvmField val confessorUin: Long = 0L,
|
||||
@ProtoId(2) @JvmField val confessToUin: Long = 0L,
|
||||
@ProtoId(3) @JvmField val sendUin: Long = 0L,
|
||||
@ -161,7 +161,7 @@ internal class GroupConfessContext(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class GroupConfessItem(
|
||||
internal class GroupConfessItem(
|
||||
@ProtoId(1) @JvmField val topicId: Int = 0,
|
||||
@ProtoId(2) @JvmField val confessToUin: Long = 0L,
|
||||
@ProtoId(3) @JvmField val confessToNick: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ -170,32 +170,32 @@ internal class GroupConfessItem(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class GroupConfessMsg(
|
||||
internal class GroupConfessMsg(
|
||||
@ProtoId(1) @JvmField val confessTime: Long = 0L,
|
||||
@ProtoId(2) @JvmField val confessorUin: Long = 0L,
|
||||
@ProtoId(3) @JvmField val confessorSex: Int = 0,
|
||||
@ProtoId(4) @JvmField val sysmsgFlag: Int = 0,
|
||||
@ProtoId(5) @JvmField val confessItems: List<HummerCommelem.MsgElemInfoServtype21.GroupConfessItem>? = null,
|
||||
@ProtoId(5) @JvmField val confessItems: List<GroupConfessItem>? = null,
|
||||
@ProtoId(6) @JvmField val totalTopicCount: Int = 0
|
||||
) : ProtoBuf
|
||||
}
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype23(
|
||||
internal class MsgElemInfoServtype23(
|
||||
@ProtoId(1) @JvmField val faceType: Int = 0,
|
||||
@ProtoId(2) @JvmField val faceBubbleCount: Int = 0,
|
||||
@ProtoId(3) @JvmField val faceSummary: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(3) @JvmField val faceSummary: String = "",
|
||||
@ProtoId(4) @JvmField val flag: Int = 0,
|
||||
@ProtoId(5) @JvmField val others: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype24(
|
||||
@ProtoId(1) @JvmField val limitChatEnter: HummerCommelem.MsgElemInfoServtype24.LimitChatEnter? = null,
|
||||
@ProtoId(2) @JvmField val limitChatExit: HummerCommelem.MsgElemInfoServtype24.LimitChatExit? = null
|
||||
internal class MsgElemInfoServtype24(
|
||||
@ProtoId(1) @JvmField val limitChatEnter: LimitChatEnter? = null,
|
||||
@ProtoId(2) @JvmField val limitChatExit: LimitChatExit? = null
|
||||
) : ProtoBuf {
|
||||
@Serializable
|
||||
internal class LimitChatEnter(
|
||||
internal class LimitChatEnter(
|
||||
@ProtoId(1) @JvmField val tipsWording: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val leftChatTime: Int = 0,
|
||||
@ProtoId(3) @JvmField val matchTs: Long = 0L,
|
||||
@ -206,42 +206,42 @@ internal class LimitChatEnter(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class LimitChatExit(
|
||||
internal class LimitChatExit(
|
||||
@ProtoId(1) @JvmField val exitMethod: Int = 0,
|
||||
@ProtoId(2) @JvmField val matchTs: Long = 0L
|
||||
) : ProtoBuf
|
||||
}
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype27(
|
||||
internal class MsgElemInfoServtype27(
|
||||
@ProtoId(1) @JvmField val videoFile: ImMsgBody.VideoFile? = null
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype29(
|
||||
internal class MsgElemInfoServtype29(
|
||||
@ProtoId(1) @JvmField val luckybagMsg: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype3(
|
||||
internal class MsgElemInfoServtype3(
|
||||
@ProtoId(1) @JvmField val flashTroopPic: ImMsgBody.CustomFace? = null,
|
||||
@ProtoId(2) @JvmField val flashC2cPic: ImMsgBody.NotOnlineImage? = null
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype31(
|
||||
internal class MsgElemInfoServtype31(
|
||||
@ProtoId(1) @JvmField val text: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val ext: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype4(
|
||||
internal class MsgElemInfoServtype4(
|
||||
@ProtoId(1) @JvmField val imsgType: Int = 0,
|
||||
@ProtoId(4) @JvmField val stStoryAioObjMsg: HummerCommelem.StoryAioObjMsg? = null
|
||||
@ProtoId(4) @JvmField val stStoryAioObjMsg: StoryAioObjMsg? = null
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype5(
|
||||
internal class MsgElemInfoServtype5(
|
||||
@ProtoId(1) @JvmField val vid: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(2) @JvmField val cover: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(3) @JvmField val title: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ -252,12 +252,12 @@ internal class MsgElemInfoServtype5(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype8(
|
||||
internal class MsgElemInfoServtype8(
|
||||
@ProtoId(1) @JvmField val wifiDeliverGiftMsg: ImMsgBody.DeliverGiftMsg? = null
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class MsgElemInfoServtype9(
|
||||
internal class MsgElemInfoServtype9(
|
||||
@ProtoId(1) @JvmField val anchorStatus: Int = 0,
|
||||
@ProtoId(2) @JvmField val jumpSchema: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@ProtoId(3) @JvmField val anchorNickname: String = "",
|
||||
@ -266,7 +266,7 @@ internal class MsgElemInfoServtype9(
|
||||
) : ProtoBuf
|
||||
|
||||
@Serializable
|
||||
internal class StoryAioObjMsg(
|
||||
internal class StoryAioObjMsg(
|
||||
@ProtoId(1) @JvmField val uiUrl: String = "",
|
||||
@ProtoId(2) @JvmField val jmpUrl: String = ""
|
||||
) : ProtoBuf
|
||||
|
@ -46,9 +46,12 @@ sealed class HummerMessage : MessageContent {
|
||||
@SinceMirai("0.31.0")
|
||||
@OptIn(MiraiInternalAPI::class)
|
||||
data class PokeMessage internal constructor(
|
||||
@MiraiExperimentalAPI("may change in future")
|
||||
/**
|
||||
* 仅 mirai, 显示的名称
|
||||
*/
|
||||
val name: String,
|
||||
|
||||
val type: Int,
|
||||
@MiraiExperimentalAPI("may change in future")
|
||||
val id: Int
|
||||
) : HummerMessage() {
|
||||
@Suppress("DEPRECATION_ERROR", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@ -58,27 +61,78 @@ data class PokeMessage internal constructor(
|
||||
|
||||
/** 戳一戳 */
|
||||
@JvmField
|
||||
val Poke = PokeMessage(1, -1)
|
||||
val Poke = PokeMessage("戳一戳", 1, -1)
|
||||
|
||||
/** 比心 */
|
||||
@JvmField
|
||||
val ShowLove = PokeMessage(2, -1)
|
||||
val ShowLove = PokeMessage("比心", 2, -1)
|
||||
|
||||
/** 点赞 */
|
||||
@JvmField
|
||||
val Like = PokeMessage(3, -1)
|
||||
val Like = PokeMessage("点赞", 3, -1)
|
||||
|
||||
/** 心碎 */
|
||||
@JvmField
|
||||
val Heartbroken = PokeMessage(4, -1)
|
||||
val Heartbroken = PokeMessage("心碎", 4, -1)
|
||||
|
||||
/** 666 */
|
||||
@JvmField
|
||||
val SixSixSix = PokeMessage(5, -1)
|
||||
val SixSixSix = PokeMessage("666", 5, -1)
|
||||
|
||||
/** 放大招 */
|
||||
@JvmField
|
||||
val FangDaZhao = PokeMessage(6, -1)
|
||||
val FangDaZhao = PokeMessage("放大招", 6, -1)
|
||||
|
||||
/** 宝贝球 (SVIP) */
|
||||
@JvmField
|
||||
val BaoBeiQiu = PokeMessage("宝贝球", 126, 2011)
|
||||
|
||||
/** 玫瑰花 (SVIP) */
|
||||
@JvmField
|
||||
val Rose = PokeMessage("玫瑰花", 126, 2007)
|
||||
|
||||
/** 召唤术 (SVIP) */
|
||||
@JvmField
|
||||
val ZhaoHuanShu = PokeMessage("召唤术", 126, 2006)
|
||||
|
||||
/** 让你皮 (SVIP) */
|
||||
@JvmField
|
||||
val RangNiPi = PokeMessage("让你皮", 126, 2009)
|
||||
|
||||
/** 结印 (SVIP) */
|
||||
@JvmField
|
||||
val JieYin = PokeMessage("结印", 126, 2005)
|
||||
|
||||
/** 手雷 (SVIP) */
|
||||
@JvmField
|
||||
val ShouLei = PokeMessage("手雷", 126, 2004)
|
||||
|
||||
/** 勾引 */
|
||||
@JvmField
|
||||
val GouYin = PokeMessage("勾引", 126, 2003)
|
||||
|
||||
/** 抓一下 (SVIP) */
|
||||
@JvmField
|
||||
val ZhuaYiXia = PokeMessage("抓一下", 126, 2001)
|
||||
|
||||
/** 碎屏 (SVIP) */
|
||||
@JvmField
|
||||
val SuiPing = PokeMessage("碎屏", 126, 2002)
|
||||
|
||||
/** 敲门 (SVIP) */
|
||||
@JvmField
|
||||
val QiaoMen = PokeMessage("敲门", 126, 2002)
|
||||
|
||||
|
||||
/**
|
||||
* 所有类型数组
|
||||
*/
|
||||
@JvmStatic
|
||||
val values: Array<PokeMessage> = arrayOf(
|
||||
Poke, ShowLove, Like, Heartbroken, SixSixSix,
|
||||
FangDaZhao, BaoBeiQiu, Rose, ZhaoHuanShu, RangNiPi,
|
||||
JieYin, ShouLei, GouYin, ZhuaYiXia, SuiPing
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(MiraiExperimentalAPI::class)
|
||||
|
Loading…
Reference in New Issue
Block a user