Shamrock: 支持新年龙表情,点开提交查看评论获取使用方法

This commit is contained in:
白池 2024-01-30 15:09:11 +08:00
parent b3d853dec3
commit e0e7a9fc2e
2 changed files with 24 additions and 5 deletions

View File

@ -500,7 +500,8 @@ internal object MessageMaker {
private suspend fun createFaceElem(chatType: Int, msgId: Long, peerId: String, data: JsonObject): Result<MsgElement> {
data.checkAndThrow("id")
val big = data["big"].asBooleanOrNull ?: false
val serverId = data["id"].asInt
val big = (data["big"].asBooleanOrNull ?: false) || serverId == 394
val elem = MsgElement()
elem.elementType = MsgConstant.KELEMTYPEFACE
@ -512,17 +513,24 @@ internal object MessageMaker {
// 4 is market face
// 5 is vas poke
face.faceType = if (big) 3 else 2
val serverId = data["id"].asInt
face.faceIndex = serverId
face.faceText = QQSysFaceUtil.getFaceDescription(QQSysFaceUtil.convertToLocal(serverId))
if (serverId == 394) {
face.stickerId = 40.toString()
face.packId = "1"
face.sourceType = 1
face.stickerType = 3
face.randomType = 1
face.resultId = data["result"].asStringOrNull ?: Random.nextInt(1 .. 5).toString()
} else if (big) {
face.imageType = 0
if (big) {
face.stickerId = 30.toString()
face.packId = "1"
face.sourceType = 1
face.stickerType = 1
face.randomType = 1
} else {
face.imageType = 0
face.packId = "0"
}
elem.faceElement = face

View File

@ -83,6 +83,17 @@ internal sealed class MessageElemConverter: IMessageConvert {
)
)
}
394 -> {
//LogCenter.log(face.toString())
return MessageSegment(
type = "face",
data = hashMapOf(
"id" to face.faceIndex,
"big" to (face.faceType == 3),
"result" to (face.resultId ?: "1")
)
)
}
else -> return MessageSegment(
type = "face",
data = hashMapOf(
@ -123,7 +134,7 @@ internal sealed class MessageElemConverter: IMessageConvert {
else -> unknownChatType(chatType)
},
"subType" to image.picSubType,
"type" to if (image.isFlashPic) "flash" else if(image.original) "original" else "show"
"type" to if (image.isFlashPic == true) "flash" else if(image.original) "original" else "show"
)
)
}