1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

fixes in parseCommandsWithParams

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

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip

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) {