mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Limit with out Permission
This commit is contained in:
parent
7a7b30766a
commit
35407acaf7
@ -12,12 +12,9 @@
|
||||
package net.mamoe.mirai.console.command
|
||||
|
||||
import net.mamoe.mirai.console.command.CommandDescriptor.SubCommandDescriptor
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
internal const val FOR_BINARY_COMPATIBILITY = "for binary compatibility"
|
||||
|
||||
/**
|
||||
* 指令
|
||||
* 通常情况下, 你的指令应继承 @see CompositeCommand/SimpleCommand
|
||||
@ -25,11 +22,12 @@ internal const val FOR_BINARY_COMPATIBILITY = "for binary compatibility"
|
||||
*/
|
||||
interface Command {
|
||||
val descriptor: CommandDescriptor
|
||||
|
||||
/**
|
||||
* Permission of the command
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class Permission(val permission:KClass<*>)
|
||||
annotation class Permission(val permission: KClass<out Permission>)
|
||||
|
||||
/**
|
||||
* If a command is prefix optional
|
||||
@ -37,7 +35,7 @@ interface Command {
|
||||
* mute work as (/mute) if prefix optional or vise versa
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class PrefixOptional()
|
||||
annotation class PrefixOptional
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +78,8 @@ abstract class CompositeCommand(val name:String, val alias:Array<String> = array
|
||||
}
|
||||
|
||||
|
||||
abstract class SimpleCommand(val name: String, val alias: Array<String> = arrayOf()
|
||||
abstract class SimpleCommand(
|
||||
val name: String, val alias: Array<String> = arrayOf()
|
||||
) : Command {
|
||||
override val descriptor: CommandDescriptor by lazy {
|
||||
CommandDescriptor()
|
||||
@ -98,6 +97,7 @@ abstract class RawCommand(name:String, alias: Array<String> = arrayOf()):Command
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析完成的指令实际参数列表. 参数顺序与 [Command.descriptor] 的 [CommandDescriptor.params] 相同.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user