mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
This reverts commit ad7f95d0
This commit is contained in:
parent
b2d6e7423a
commit
69a48987e7
@ -376,15 +376,6 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bot.network.run {
|
|
||||||
val resp =
|
|
||||||
TroopManagement.GetAdmin(bot.client, groupCode).sendAndExpect<TroopManagement.GetAdmin.Response>()
|
|
||||||
check(resp is TroopManagement.GetAdmin.Response.Success) { "Failed to get admin info" }
|
|
||||||
sequence.filter { member -> member.permission == MemberPermission.MEMBER && resp.memberList.any { member.uin == it.memberUin } }
|
|
||||||
.forEach { memberInfoImpl ->
|
|
||||||
memberInfoImpl.permission = MemberPermission.ADMINISTRATOR
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sequence
|
return sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +37,9 @@ internal data class MemberInfoImpl(
|
|||||||
) : this(
|
) : this(
|
||||||
uin = jceInfo.memberUin,
|
uin = jceInfo.memberUin,
|
||||||
nick = jceInfo.nick,
|
nick = jceInfo.nick,
|
||||||
// 管理员将在 MiraiImpl.kt:359
|
permission = when {
|
||||||
// TroopManagement.GetAdmin 处理
|
jceInfo.memberUin == groupOwnerId -> MemberPermission.OWNER
|
||||||
permission = when (jceInfo.memberUin) {
|
jceInfo.dwFlag == 1L -> MemberPermission.ADMINISTRATOR
|
||||||
groupOwnerId -> MemberPermission.OWNER
|
|
||||||
else -> MemberPermission.MEMBER
|
else -> MemberPermission.MEMBER
|
||||||
},
|
},
|
||||||
remark = jceInfo.autoRemark.orEmpty(),
|
remark = jceInfo.autoRemark.orEmpty(),
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -149,7 +149,6 @@ internal object KnownPacketFactories {
|
|||||||
TroopManagement.GroupOperation,
|
TroopManagement.GroupOperation,
|
||||||
TroopManagement.GetTroopConfig,
|
TroopManagement.GetTroopConfig,
|
||||||
TroopManagement.ModifyAdmin,
|
TroopManagement.ModifyAdmin,
|
||||||
TroopManagement.GetAdmin,
|
|
||||||
// TroopManagement.GetGroupInfo,
|
// TroopManagement.GetGroupInfo,
|
||||||
TroopManagement.EditGroupNametag,
|
TroopManagement.EditGroupNametag,
|
||||||
TroopManagement.Kick,
|
TroopManagement.Kick,
|
||||||
|
@ -30,7 +30,6 @@ import net.mamoe.mirai.internal.utils.io.serialization.*
|
|||||||
import net.mamoe.mirai.utils.daysToSeconds
|
import net.mamoe.mirai.utils.daysToSeconds
|
||||||
|
|
||||||
internal class TroopManagement {
|
internal class TroopManagement {
|
||||||
|
|
||||||
internal object Mute : OutgoingPacketFactory<Mute.Response>("OidbSvc.0x570_8") {
|
internal object Mute : OutgoingPacketFactory<Mute.Response>("OidbSvc.0x570_8") {
|
||||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
|
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
|
||||||
//屁用没有
|
//屁用没有
|
||||||
@ -68,6 +67,7 @@ internal class TroopManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal object GetGroupInfo : OutgoingPacketFactory<GroupInfoImpl>("OidbSvc.0x88d_7") {
|
internal object GetGroupInfo : OutgoingPacketFactory<GroupInfoImpl>("OidbSvc.0x88d_7") {
|
||||||
@Deprecated("")
|
@Deprecated("")
|
||||||
operator fun invoke(
|
operator fun invoke(
|
||||||
@ -419,52 +419,4 @@ internal class TroopManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
internal object GetAdmin : OutgoingPacketFactory<GetAdmin.Response>("OidbSvc.0x899_9") {
|
|
||||||
operator fun invoke(
|
|
||||||
client: QQAndroidClient,
|
|
||||||
groupCode: Long
|
|
||||||
): OutgoingPacket = buildOutgoingUniPacket(client) {
|
|
||||||
writeProtoBuf(
|
|
||||||
OidbSso.OIDBSSOPkg.serializer(),
|
|
||||||
OidbSso.OIDBSSOPkg(
|
|
||||||
command = 2201,
|
|
||||||
serviceType = 1,
|
|
||||||
result = 0,
|
|
||||||
bodybuffer = Oidb0x899.ReqBody(
|
|
||||||
identifyFlag = 2,
|
|
||||||
groupCode = groupCode,
|
|
||||||
startUin = 0,
|
|
||||||
memberListOpt = Oidb0x899.MemberList(
|
|
||||||
memberUin = 0,
|
|
||||||
privilege = 1
|
|
||||||
)
|
|
||||||
).toByteArray(Oidb0x899.ReqBody.serializer())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
|
|
||||||
return readProtoBuf(OidbSso.OIDBSSOPkg.serializer()).let { oidbssoPkg ->
|
|
||||||
if (oidbssoPkg.result == 0) {
|
|
||||||
oidbssoPkg.bodybuffer.loadAs(Oidb0x899.RspBody.serializer()).let { resp ->
|
|
||||||
Response.Success(resp.memberList)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Response.Failed(oidbssoPkg.result, oidbssoPkg.errorMsg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class Response : Packet {
|
|
||||||
class Failed(val code: Int, val msg: String) : Response() {
|
|
||||||
override fun toString(): String = "GetAdmin.Response.Failed(code=$code, msg=$msg)"
|
|
||||||
}
|
|
||||||
|
|
||||||
class Success(val memberList: List<Oidb0x899.MemberList>) : Response() {
|
|
||||||
override fun toString(): String = "GetAdmin.Response.Success"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user