mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
commit
f47ae69653
@ -61,7 +61,7 @@ class ProtoMap(
|
|||||||
var curMap = value
|
var curMap = value
|
||||||
tags.forEachIndexed { index, tag ->
|
tags.forEachIndexed { index, tag ->
|
||||||
if (index == tags.size - 1) {
|
if (index == tags.size - 1) {
|
||||||
return curMap[tag] ?: error("Tag $tag not found")
|
return curMap[tag] ?: error("pb[${tags.joinToString(", ")}][$index] Tag $tag not found")
|
||||||
}
|
}
|
||||||
curMap[tag]?.let { v ->
|
curMap[tag]?.let { v ->
|
||||||
if (v is ProtoMap) {
|
if (v is ProtoMap) {
|
||||||
@ -69,7 +69,7 @@ class ProtoMap(
|
|||||||
} else {
|
} else {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
} ?: error("Tag $tag not found")
|
} ?: error("pb[${tags.joinToString(", ")}][$index] Tag $tag not found")
|
||||||
}
|
}
|
||||||
error("Instance is not ProtoMap for get(${tags.first()})")
|
error("Instance is not ProtoMap for get(${tags.first()})")
|
||||||
}
|
}
|
||||||
|
@ -305,6 +305,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
|
|
||||||
suspend fun transGroupBan(
|
suspend fun transGroupBan(
|
||||||
msgTime: Long,
|
msgTime: Long,
|
||||||
|
subType: NoticeSubType,
|
||||||
operation: Long,
|
operation: Long,
|
||||||
target: Long,
|
target: Long,
|
||||||
groupCode: Long,
|
groupCode: Long,
|
||||||
@ -315,7 +316,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
selfId = app.longAccountUin,
|
selfId = app.longAccountUin,
|
||||||
postType = PostType.Notice,
|
postType = PostType.Notice,
|
||||||
type = NoticeType.GroupBan,
|
type = NoticeType.GroupBan,
|
||||||
subType = if (duration == 0) NoticeSubType.LiftBan else NoticeSubType.Ban,
|
subType = subType,
|
||||||
operatorId = operation,
|
operatorId = operation,
|
||||||
userId = target,
|
userId = target,
|
||||||
senderId = operation,
|
senderId = operation,
|
||||||
|
@ -452,14 +452,22 @@ internal object PrimitiveListener {
|
|||||||
private suspend fun onGroupBan(msgTime: Long, pb: ProtoMap) {
|
private suspend fun onGroupBan(msgTime: Long, pb: ProtoMap) {
|
||||||
val groupCode = pb[1, 3, 2, 1].asULong
|
val groupCode = pb[1, 3, 2, 1].asULong
|
||||||
val operatorUid = pb[1, 3, 2, 4].asUtf8String
|
val operatorUid = pb[1, 3, 2, 4].asUtf8String
|
||||||
val targetUid = pb[1, 3, 2, 5, 3, 1].asUtf8String
|
val wholeBan = !pb.has(1, 3, 2, 5, 3, 1)
|
||||||
val duration = pb[1, 3, 2, 5, 3, 2].asInt
|
val targetUid = if (wholeBan) "" else pb[1, 3, 2, 5, 3, 1].asUtf8String
|
||||||
val operation = ContactHelper.getUinByUidAsync(operatorUid).toLong()
|
val rawDuration = pb[1, 3, 2, 5, 3, 2].asInt
|
||||||
val target = ContactHelper.getUinByUidAsync(targetUid).toLong()
|
|
||||||
LogCenter.log("群禁言($groupCode): $operation -> $target, 时长 = ${duration}s")
|
|
||||||
|
|
||||||
|
val operation = ContactHelper.getUinByUidAsync(operatorUid).toLong()
|
||||||
|
val duration = if (wholeBan) -1 else rawDuration
|
||||||
|
val target = if (wholeBan) 0 else ContactHelper.getUinByUidAsync(targetUid).toLong()
|
||||||
|
val subType = if (rawDuration == 0) NoticeSubType.LiftBan else NoticeSubType.Ban
|
||||||
|
|
||||||
|
if (wholeBan) {
|
||||||
|
LogCenter.log("群全员禁言($groupCode): $operation -> ${if (subType == NoticeSubType.Ban) "开启" else "关闭"}")
|
||||||
|
} else {
|
||||||
|
LogCenter.log("群禁言($groupCode): $operation -> $target, 时长 = ${duration}s")
|
||||||
|
}
|
||||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||||
.transGroupBan(msgTime, operation, target, groupCode, duration)
|
.transGroupBan(msgTime, subType, operation, target, groupCode, duration)
|
||||||
) {
|
) {
|
||||||
LogCenter.log("群禁言推送失败!", Level.WARN)
|
LogCenter.log("群禁言推送失败!", Level.WARN)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user