diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt index a895207729..1fbc3edeb0 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/TextCaptionBotCommandsParser.kt @@ -18,10 +18,12 @@ fun List.parseCommandsWithParams( var currentArgs = "" fun includeCurrent() = currentBotCommandSource ?.let { currentArgs = currentArgs.trim() - if (currentArgs.isNotEmpty()) { - result[it.command] = currentArgs.split(argsSeparator).toTypedArray() - currentArgs = "" + result[it.command] = if (currentArgs.isNotEmpty()) { + currentArgs.split(argsSeparator).toTypedArray() + } else { + emptyArray() } + currentArgs = "" } for (textSource in this) { if (textSource is BotCommandTextSource) {