From 8e8dd0e26b02f86f6a1c9f7cd57131cc2770d5bf Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 26 Nov 2021 18:02:10 +0000 Subject: [PATCH] minor: Do not use Member but required properties in TroopManagement.Kick --- .../src/commonMain/kotlin/contact/NormalMemberImpl.kt | 3 ++- .../kotlin/network/protocol/packet/chat/TroopManagement.kt | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt b/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt index ccfed852a..f3fc96c10 100644 --- a/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/NormalMemberImpl.kt @@ -171,7 +171,8 @@ internal class NormalMemberImpl constructor( bot.network.run { val response: TroopManagement.Kick.Response = TroopManagement.Kick( client = bot.client, - member = this@NormalMemberImpl, + groupCode = group.groupCode, + memberId = id, message = message, ban = block ).sendAndExpect() diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt index a80e9d555..56f99592d 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt @@ -191,7 +191,8 @@ internal class TroopManagement { operator fun invoke( client: QQAndroidClient, - member: Member, + groupCode: Long, + memberId: Long, message: String, ban: Boolean ) = buildOutgoingUniPacket(client) { @@ -202,11 +203,11 @@ internal class TroopManagement { serviceType = 0,//或者1 result = 0, bodybuffer = Oidb0x8a0.ReqBody( - optUint64GroupCode = member.group.id, + optUint64GroupCode = groupCode, msgKickList = listOf( Oidb0x8a0.KickMemberInfo( optUint32Operate = 5, - optUint64MemberUin = member.id, + optUint64MemberUin = memberId, optUint32Flag = if (ban) 1 else 0 //1为拉黑 ) ),