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