tgbotapi/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/BotCommandMessageEntity.kt

18 lines
622 B
Kotlin
Raw Normal View History

2018-12-26 08:07:24 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
2019-03-31 03:54:49 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandHTML
import com.github.insanusmokrassar.TelegramBotAPI.utils.commandMarkdown
2018-12-26 08:07:24 +00:00
data class BotCommandMessageEntity(
override val offset: Int,
override val length: Int,
override val sourceString: String
) : MessageEntity {
override val asMarkdownSource: String = sourceString.commandMarkdown()
override val asHtmlSource: String = sourceString.commandHTML()
2018-12-26 08:07:24 +00:00
val command: String by lazy {
sourceString.substring(1)// skip first symbol like "/" or "!"
}
}