mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-07 00:20:09 +08:00
Rename OPERATOR to ADMINISTRATOR, add extensions
This commit is contained in:
parent
b4b0559c2f
commit
d5dd86549b
@ -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()
|
@ -202,7 +202,7 @@ object GroupPacket : SessionPacketFactory<GroupPacket.GroupPacketResponse>() {
|
||||
}
|
||||
|
||||
val permission = when (status.takeLowestOneBit()) {
|
||||
1 -> MemberPermission.OPERATOR
|
||||
1 -> MemberPermission.ADMINISTRATOR
|
||||
else -> MemberPermission.MEMBER
|
||||
}
|
||||
members[qq] = permission
|
||||
|
Loading…
Reference in New Issue
Block a user