diff --git a/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/ArgsLengthCheck.kt b/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/ArgsLengthCheck.kt index 4a27800..55f57d7 100644 --- a/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/ArgsLengthCheck.kt +++ b/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/ArgsLengthCheck.kt @@ -24,9 +24,9 @@ class ArgsLengthCheck { val inspector = instance.get() try { when { - cmd.lowercase() == Cmd.Mj.code -> inspector.mj(args) - cmd.lowercase() == Cmd.Chat.code -> inspector.chat(args) - cmd.lowercase() == Cmd.Emoji.code -> inspector.emoji(args) + cmd.lowercase() == Cmd.Mj.cmd -> inspector.mj(args) + cmd.lowercase() == Cmd.Chat.cmd -> inspector.chat(args) + cmd.lowercase() == Cmd.Emoji.cmd -> inspector.emoji(args) } } catch (ex: ConstraintViolationException) { CmdException.fail(ex) diff --git a/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/FunctionContextImpl.kt b/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/FunctionContextImpl.kt index 90a5439..df60be1 100644 --- a/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/FunctionContextImpl.kt +++ b/tokisaki-function/src/main/kotlin/io/micro/function/domain/strategy/FunctionContextImpl.kt @@ -28,7 +28,7 @@ class FunctionContextImpl( @PostConstruct fun allocateCommandServices() { for (commandService in commandServices) { - allocationCommandServices[commandService.cmd().code] = commandService + allocationCommandServices[commandService.cmd().cmd] = commandService if (commandService is ImageTask) { allocationImageTask[commandService.cmd()] = commandService } @@ -36,15 +36,15 @@ class FunctionContextImpl( } override fun call(cmd: Cmd, args: MutableList, config: Map): Uni { - val code = cmd.code - ArgsLengthCheck.check(code, args) - return with(allocationCommandServices[code.lowercase()]) { + val cmd = cmd.cmd + ArgsLengthCheck.check(cmd, args) + return with(allocationCommandServices[cmd.lowercase()]) { this?.invoke(args, config) ?: CmdException.nonImplemented() } } override fun config(cmd: Cmd): ConfigHint? { - return with(allocationCommandServices[cmd.code.lowercase()]) { this?.configHint() } + return with(allocationCommandServices[cmd.cmd.lowercase()]) { this?.configHint() } } override fun menu(): Uni {