From 1e41e953333d7eb4f9246d2a94381750cb877298 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 29 Apr 2021 15:07:16 +0600 Subject: [PATCH] fixes in parseCommandsWithParams --- .../utils/extensions/TextCaptionBotCommandsParser.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) {