Commit 128125ee authored by Him188's avatar Him188

Support more poke messages

parent 3c98151f
......@@ -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())
......
......@@ -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)
......
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