From cdefb2dbed3550ead4310c6ee9657fb25f257d5b Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 30 Oct 2020 10:01:38 +0800 Subject: [PATCH] Cleanup code --- .../mamoe/mirai/console/internal/command/CommandReflector.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt index d6e3a85e0..d39eb6a8f 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt @@ -71,7 +71,7 @@ internal object SimpleCommandSubCommandAnnotationResolver : override fun getAnnotatedName(ownerCommand: Command, parameter: KParameter): String? = parameter.findAnnotation()?.value - override fun getDescription(ownerCommand: Command, function: KFunction<*>): String? = + override fun getDescription(ownerCommand: Command, function: KFunction<*>): String = ownerCommand.description } @@ -274,7 +274,7 @@ internal class CommandReflector( }.toList() } - private fun KParameter.toCommandReceiverParameter(): CommandReceiverParameter? { + private fun KParameter.toCommandReceiverParameter(): CommandReceiverParameter { check(!this.isVararg) { "Receiver cannot be vararg." } check(this.type.classifierAsKClass().isSubclassOf(CommandSender::class)) { "Receiver must be subclass of CommandSender" }