Simple

@Serializable(with = PollOption.Companion::class)
data class Simple(val id: PollOptionPersistentId, val text: String, val textSources: List<TextSource> = emptyList(), val votes: Int = 0, val media: PollMedia? = null) : PollOption(source)

Constructors

Link copied to clipboard
constructor(id: PollOptionPersistentId, text: String, textSources: List<TextSource> = emptyList(), votes: Int = 0, media: PollMedia? = null)

Properties

Link copied to clipboard
@SerialName(value = "persistent_id")
open override val id: PollOptionPersistentId
Link copied to clipboard
@SerialName(value = "media")
@Serializable(with = PollMedia.Serializer::class)
open override val media: PollMedia?
Link copied to clipboard
@SerialName(value = "text")
open override val text: String
Link copied to clipboard
@SerialName(value = "text_entities")
open override val textSources: List<TextSource>

Full list of TextSources

Link copied to clipboard
@SerialName(value = "voter_count")
open override val votes: Int

Functions

Link copied to clipboard
open override fun asInput(): InputPollOption
Link copied to clipboard
fun TextedWithTextSources.parseCommandsWithArgs(argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex): Map<String, Array<String>>

Parse commands and their args. Logic will find command, get all subsequent data as args until new command

Link copied to clipboard

Parse text sources to find commands with their arguments. This method will skip all the text sources before first command and all following text sources until the next command will be guessed as an args of last found command

Link copied to clipboard
fun TextedWithTextSources.parseCommandsWithNamedArgs(argsSeparator: String, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex): Map<String, List<Pair<String, String>>>
fun TextedWithTextSources.parseCommandsWithNamedArgs(argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex): Map<String, List<Pair<String, String>>>

Uses parseCommandsWithArgs to create base argsSeparator split args for commands and map their as k-v pairs. Sample: