From ac7bf60182aeae2d3e2b2dfe9e87155d01eca0f1 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 13 Oct 2022 23:30:34 +0600 Subject: [PATCH] Update BotCommandTextSource.kt --- .../types/message/textsources/BotCommandTextSource.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt index 8dbbfe804e..5c3d49e741 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt @@ -13,14 +13,14 @@ private val commandRegex = Regex("[/!][^@\\s]*") * @see botCommand */ @Serializable -data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor( +data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor ( override val source: String ) : TextSource { val command: String by lazy { - commandRegex.find(source)?.value?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!" + commandRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!" } val username: Username? by lazy { - Username(usernameRegex.find(source)?.value ?: return@lazy null) + Username(usernameRegex.find(source) ?.value ?: return@lazy null) } override val markdown: String by lazy { source.commandMarkdown() } @@ -35,4 +35,4 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru inline fun botCommand(command: String) = BotCommandTextSource("/$command") @Suppress("NOTHING_TO_INLINE") -inline fun botCommand(botCommand: BotCommand) = botCommand(botCommand.command) \ No newline at end of file +inline fun botCommand(botCommand: BotCommand) = botCommand(botCommand.command)