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 9a98265d5..7dba94838 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 @@ -77,21 +77,39 @@ enum class MemberPermission { 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() +inline fun MemberPermission.isOperator(): 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 +inline fun Member.isOperator(): Boolean = this.permission.isOperator() \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt index 839548bb2..a85024334 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/internal/ContactImpl.kt @@ -135,7 +135,7 @@ internal data class MemberImpl(private val delegate: QQ, override val group: Gro when (group.getMember(bot.qqAccount).permission) { MemberPermission.MEMBER -> return false - MemberPermission.OPERATOR -> if (permission == MemberPermission.OPERATOR) return false + MemberPermission.ADMINISTRATOR -> if (permission == MemberPermission.ADMINISTRATOR) return false MemberPermission.OWNER -> { } }