diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt index d725fb31a..9a98265d5 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt @@ -70,9 +70,28 @@ enum class MemberPermission { /** * 管理员 */ - OPERATOR, + ADMINISTRATOR, /** * 一般群成员 */ MEMBER; } + +@Suppress("NOTHING_TO_INLINE") +inline fun MemberPermission.isOwner(): Boolean = this == MemberPermission.OWNER + +@Suppress("NOTHING_TO_INLINE") +inline fun MemberPermission.isAdministrator(): Boolean = this == MemberPermission.ADMINISTRATOR + +@Suppress("NOTHING_TO_INLINE") +inline fun MemberPermission.isAdministratorOrOwner(): Boolean = isAdministrator() || isOwner() + + +@Suppress("NOTHING_TO_INLINE") +inline fun Member.isOwner(): Boolean = this.permission.isOwner() + +@Suppress("NOTHING_TO_INLINE") +inline fun Member.isAdministrator(): Boolean = this.permission.isAdministrator() + +@Suppress("NOTHING_TO_INLINE") +inline fun Member.isAdministratorOrOwner(): Boolean = this.permission.isAdministratorOrOwner() \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/packet/action/GroupPacket.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/packet/action/GroupPacket.kt index ca9b0f2f9..e09fc4d2f 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/packet/action/GroupPacket.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/packet/action/GroupPacket.kt @@ -202,7 +202,7 @@ object GroupPacket : SessionPacketFactory() { } val permission = when (status.takeLowestOneBit()) { - 1 -> MemberPermission.OPERATOR + 1 -> MemberPermission.ADMINISTRATOR else -> MemberPermission.MEMBER } members[qq] = permission