mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
change command structure
This commit is contained in:
parent
5b4ef278fd
commit
d9964529cb
@ -42,37 +42,34 @@ interface Command {
|
||||
/**
|
||||
* 在更多的情况下, 你应当使用 @SubCommand 来注册一共 sub 指令
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class SubCommand(val name:String)
|
||||
|
||||
/**
|
||||
* 这是个例子
|
||||
@SubCommand("add")
|
||||
@Permission(CommandPermission.Console::class)
|
||||
@Usage("禁言一个群员")
|
||||
suspend fun CommandSender.onMyMethod1(
|
||||
@Name("被禁言的人") member: Member,
|
||||
@Name("时间") time:Int
|
||||
)
|
||||
*/
|
||||
|
||||
* Permission of the command
|
||||
*
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class Permission(val permission:KClass<*>)
|
||||
|
||||
/**
|
||||
* Usage of the sub command
|
||||
*
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class Usage(val usage:String)
|
||||
|
||||
|
||||
/**
|
||||
* name of the parameter
|
||||
*
|
||||
* by default available
|
||||
*
|
||||
*/
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class Name(val name:String)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class SubCommand(
|
||||
val name:String
|
||||
){
|
||||
|
||||
}
|
||||
/**
|
||||
* 指令实际参数列表. 参数顺序与 [Command.descriptor] 的 [CommandDescriptor.params] 相同.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user