Rename OPERATOR to ADMINISTRATOR

This commit is contained in:
Him188 2019-12-04 12:26:17 +08:00
parent 01c7007f3c
commit b8323a5ed6
2 changed files with 21 additions and 3 deletions

View File

@ -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()
inline fun Member.isOperator(): Boolean = this.permission.isOperator()

View File

@ -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 -> {
}
}