Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Shamrock: fix 群头衔推送
Browse files Browse the repository at this point in the history
  • Loading branch information
Simplxss committed Dec 2, 2023
1 parent bffb7ca commit b5a9884
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,23 +319,23 @@ internal sealed class MessageElemConverter: IMessageConvert {
element: MsgElement
): MessageSegment {
val tip = element.grayTipElement
when(val tipType = tip.subElementType) {
when(tip.subElementType) {
MsgConstant.GRAYTIPELEMENTSUBTYPEJSON -> {
val notify = tip.jsonGrayTipElement
when(notify.busiId) {
/* 新人入群 */ 17L,
/* 群戳一戳 */1061L, /* 群撤回 */1014L -> {}
else -> LogCenter.log("不支持的灰条类型(JSON): $tipType", Level.WARN)
/* 新人入群 */ 17L, /* 群戳一戳 */1061L,
/* 群撤回 */1014L, /* 群设精消息 */2401L -> {}
else -> LogCenter.log("不支持的灰条类型(JSON): ${notify.busiId}", Level.WARN)
}
}
MsgConstant.GRAYTIPELEMENTSUBTYPEXMLMSG -> {
val notify = tip.xmlElement
when(notify.busiId) {
/* 群戳一戳 */12L -> {}
else -> LogCenter.log("不支持的灰条类型(XML): $tipType", Level.WARN)
/* 群戳一戳 */1061L -> {}
else -> LogCenter.log("不支持的灰条类型(XML): ${notify.busiId}", Level.WARN)
}
}
else -> LogCenter.log("不支持的提示类型: $tip", Level.WARN)
else -> LogCenter.log("不支持的提示类型: ${tip.subElementType}", Level.WARN)
}
// 提示类消息,这里提供的是一个xml,不具备解析通用性
// 在这里不推送
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ internal object PrimitiveListener {
val groupId = pb[1, 3, 2, 1, 13, 4].asLong
var oldCard = ""
val targetQQ = ContactHelper.getUinByUidAsync(targetId).toLong()
LogCenter.log("群组[$groupId]成员$targetId 群名片变动 -> $newCard")
LogCenter.log("群组[$groupId]成员$targetQQ 群名片变动 -> $newCard")
// oldCard暂时获取不到
// GroupSvc.getTroopMemberInfoByUin(groupId.toString(), targetQQ.toString()).onSuccess {
// oldCard = it.troopnick
Expand All @@ -181,12 +181,20 @@ internal object PrimitiveListener {
}

private suspend fun onGroupTitleChange(msgTime: Long, pb: ProtoMap) {
val targetUin = pb[1, 3, 2, 5, 5].asLong
val groupCode = pb[1, 1, 1].asULong

val groupId = pb[1, 3, 2, 4].asLong
val readPacket = ByteReadPacket(pb[1, 3, 2].asByteArray)
val detail = if (readPacket.readBuf32Long() == groupCode) {
readPacket.discardExact(1)
ProtoUtils.decodeFromByteArray(readPacket.readBytes(readPacket.readShort().toInt()))
} else pb[1, 3, 2]

val targetUin = detail[5, 5].asLong

val groupId = detail[4].asLong

// 恭喜<{\"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 = pb[1, 3, 2, 5, 2].asUtf8String
val titleChangeInfo = detail[5, 2].asUtf8String
if (titleChangeInfo.indexOf("群主授予") == -1) {
return
}
Expand Down

0 comments on commit b5a9884

Please sign in to comment.