mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
CompositeCommand usage
This commit is contained in:
parent
538cb574f7
commit
9a87497a06
@ -295,3 +295,20 @@ internal inline fun <reified T : Annotation> KAnnotatedElement.hasAnnotation():
|
|||||||
internal inline fun <T:Any> KClass<out T>.getInstance():T {
|
internal inline fun <T:Any> KClass<out T>.getInstance():T {
|
||||||
return this.objectInstance ?: this.createInstance()
|
return this.objectInstance ?: this.createInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun main(){
|
||||||
|
val mute = object:CompositeCommand(
|
||||||
|
TestCommandOwner,
|
||||||
|
"mute"
|
||||||
|
){
|
||||||
|
@SubCommand("add")
|
||||||
|
fun CommandSender.onMute1(@Name("参数名1") target: String):Boolean{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mute.subCommands
|
||||||
|
|
||||||
|
println(mute.usage)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user