1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-24 23:25:49 +00:00

fixes in parseCommandsWithParams

This commit is contained in:
2021-04-13 01:50:41 +06:00
parent e7bbce3fa7
commit 3069a6084c
2 changed files with 6 additions and 3 deletions

View File

@@ -18,8 +18,11 @@ fun List<TextSource>.parseCommandsWithParams(
var currentBotCommandSource: BotCommandTextSource? = null
var currentArgs = ""
fun includeCurrent() = currentBotCommandSource ?.let {
result[it.command] = currentArgs.split(argsSeparator).toTypedArray()
currentArgs = ""
currentArgs = currentArgs.trim()
if (currentArgs.isNotEmpty()) {
result[it.command] = currentArgs.split(argsSeparator).toTypedArray()
currentArgs = ""
}
}
for (textSource in this) {
if (textSource is BotCommandTextSource) {