mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 13:49:26 +00:00
add waitCommands* expectations
This commit is contained in:
@@ -81,6 +81,8 @@ sealed interface StickerType {
|
||||
}
|
||||
}
|
||||
|
||||
val usernameRegex = Regex("@[\\w\\d_]+")
|
||||
|
||||
val degreesLimit = 1 .. 360
|
||||
val horizontalAccuracyLimit = 0F .. 1500F
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.usernameRegex
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -16,6 +17,9 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru
|
||||
val command: String by lazy {
|
||||
commandRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
val username: String? by lazy {
|
||||
usernameRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol "@"
|
||||
}
|
||||
|
||||
override val markdown: String by lazy { source.commandMarkdown() }
|
||||
override val markdownV2: String by lazy { source.commandMarkdownV2() }
|
||||
|
Reference in New Issue
Block a user