mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-04 15:49:41 +00:00
bot command entity command extracting fix
This commit is contained in:
@@ -3,6 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandHTML
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandMarkdown
|
||||
|
||||
private val commandRegex = Regex("[/!][^@\\s]*")
|
||||
|
||||
data class BotCommandMessageEntity(
|
||||
override val offset: Int,
|
||||
override val length: Int,
|
||||
@@ -12,6 +14,6 @@ data class BotCommandMessageEntity(
|
||||
override val asHtmlSource: String = sourceString.commandHTML()
|
||||
|
||||
val command: String by lazy {
|
||||
sourceString.substring(1)// skip first symbol like "/" or "!"
|
||||
commandRegex.find(sourceString) ?.value ?.substring(1) ?: sourceString.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user