Merge pull request #194 from MrXiaoM/fix-group-title-change

修复群头衔更改通知报错
This commit is contained in:
白池 2024-01-07 15:13:19 +08:00 committed by GitHub
commit f311ae3797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View File

@ -324,7 +324,8 @@ internal sealed class MessageElemConverter: IMessageConvert {
val notify = tip.jsonGrayTipElement val notify = tip.jsonGrayTipElement
when(notify.busiId) { when(notify.busiId) {
/* 新人入群 */ 17L, /* 群戳一戳 */1061L, /* 新人入群 */ 17L, /* 群戳一戳 */1061L,
/* 群撤回 */1014L, /* 群设精消息 */2401L -> {} /* 群撤回 */1014L, /* 群设精消息 */2401L,
/* 群头衔 */2407L -> {}
else -> LogCenter.log("不支持的灰条类型(JSON): ${notify.busiId}", Level.WARN) else -> LogCenter.log("不支持的灰条类型(JSON): ${notify.busiId}", Level.WARN)
} }
} }

View File

@ -12,15 +12,7 @@ import kotlinx.io.core.discardExact
import kotlinx.io.core.readBytes import kotlinx.io.core.readBytes
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonElement
import moe.fuqiuluo.proto.ProtoByteString import moe.fuqiuluo.proto.*
import moe.fuqiuluo.proto.ProtoMap
import moe.fuqiuluo.proto.asInt
import moe.fuqiuluo.proto.asLong
import moe.fuqiuluo.proto.asUtf8String
import moe.fuqiuluo.proto.ProtoUtils
import moe.fuqiuluo.proto.asByteArray
import moe.fuqiuluo.proto.asList
import moe.fuqiuluo.proto.asULong
import moe.fuqiuluo.qqinterface.servlet.FriendSvc.requestFriendSystemMsgNew import moe.fuqiuluo.qqinterface.servlet.FriendSvc.requestFriendSystemMsgNew
import moe.fuqiuluo.qqinterface.servlet.GroupSvc.requestGroupSystemMsgNew import moe.fuqiuluo.qqinterface.servlet.GroupSvc.requestGroupSystemMsgNew
import moe.fuqiuluo.qqinterface.servlet.TicketSvc.getLongUin import moe.fuqiuluo.qqinterface.servlet.TicketSvc.getLongUin
@ -211,9 +203,12 @@ internal object PrimitiveListener {
LogCenter.log("onGroupTitleChange error: ${e.stackTraceToString()}", Level.WARN) LogCenter.log("onGroupTitleChange error: ${e.stackTraceToString()}", Level.WARN)
} }
} }
var detail5 = detail[5]
if (detail5 is ProtoList) {
detail5 = detail5.value.first { it is ProtoMap }
}
val targetUin = detail[5, 5].asLong val targetUin = detail5[5].asLong
var groupId:Long var groupId:Long
try { try {
groupId = detail[4].asULong groupId = detail[4].asULong
@ -222,7 +217,7 @@ internal object PrimitiveListener {
} }
// 恭喜<{\"cmd\":5,\"data\":\"qq\",\"text}\":\"nickname\"}>获得群主授予的<{\"cmd\":1,\"data\":\"https://qun.qq.com/qqweb/m/qun/medal/detail.html?_wv=16777223&bid=2504&gc=gid&isnew=1&medal=302&uin=uin\",\"text\":\"title\",\"url\":\"https://qun.qq.com/qqweb/m/qun/medal/detail.html?_wv=16777223&bid=2504&gc=gid&isnew=1&medal=302&uin=uin\"}>头衔 // 恭喜<{\"cmd\":5,\"data\":\"qq\",\"text}\":\"nickname\"}>获得群主授予的<{\"cmd\":1,\"data\":\"https://qun.qq.com/qqweb/m/qun/medal/detail.html?_wv=16777223&bid=2504&gc=gid&isnew=1&medal=302&uin=uin\",\"text\":\"title\",\"url\":\"https://qun.qq.com/qqweb/m/qun/medal/detail.html?_wv=16777223&bid=2504&gc=gid&isnew=1&medal=302&uin=uin\"}>头衔
val titleChangeInfo = detail[5, 2].asUtf8String val titleChangeInfo = detail5[2].asUtf8String
if (titleChangeInfo.indexOf("群主授予") == -1) { if (titleChangeInfo.indexOf("群主授予") == -1) {
return return
} }