mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 06:10:30 +08:00
Introduce permission comparing for MemberPermission via ordinal comparison
This commit is contained in:
parent
b82ac12de2
commit
a150af2e3e
@ -13,24 +13,33 @@ package net.mamoe.mirai.contact
|
|||||||
|
|
||||||
import net.mamoe.mirai.Bot
|
import net.mamoe.mirai.Bot
|
||||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||||
|
import net.mamoe.mirai.utils.SinceMirai
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 群成员的权限
|
* 群成员的权限.
|
||||||
|
*
|
||||||
|
* 可通过 [compareTo] 判断是否有更高的权限.
|
||||||
*/
|
*/
|
||||||
enum class MemberPermission {
|
enum class MemberPermission : Comparable<MemberPermission> {
|
||||||
/**
|
|
||||||
* 群主
|
|
||||||
*/
|
|
||||||
OWNER,
|
|
||||||
/**
|
|
||||||
* 管理员
|
|
||||||
*/
|
|
||||||
ADMINISTRATOR,
|
|
||||||
/**
|
/**
|
||||||
* 一般群成员
|
* 一般群成员
|
||||||
*/
|
*/
|
||||||
MEMBER;
|
MEMBER, // ordinal = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员
|
||||||
|
*/
|
||||||
|
ADMINISTRATOR, // ordinal = 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 群主
|
||||||
|
*/
|
||||||
|
OWNER; // ordinal = 2
|
||||||
|
|
||||||
|
@SinceMirai("0.32.0")
|
||||||
|
val level: Int
|
||||||
|
get() = ordinal
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user