From 71c744c4296af1e4b9ea3addced88f46fda100d1 Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 30 Oct 2020 11:35:26 +0800 Subject: [PATCH] Fix command reflection --- .../mirai-console/src/internal/command/CommandReflector.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/mirai-console/src/internal/command/CommandReflector.kt b/backend/mirai-console/src/internal/command/CommandReflector.kt index 1e172f90a..1bf73d773 100644 --- a/backend/mirai-console/src/internal/command/CommandReflector.kt +++ b/backend/mirai-console/src/internal/command/CommandReflector.kt @@ -230,10 +230,10 @@ internal class CommandReflector( .onEach { it.checkNames() } .flatMap { function -> val names = annotationResolver.getSubCommandNames(command, function) - if (names.isEmpty()) sequenceOf(createMapEntry(function, null)) - else names.associateBy { function }.asSequence() + if (names.isEmpty()) sequenceOf(createMapEntry(null, function)) + else names.associateWith { function }.asSequence() } - .map { (function, name) -> + .map { (name, function) -> val functionNameAsValueParameter = name?.split(' ')?.mapIndexed { index, s -> createStringConstantParameter(index, s) }