QuizPoll

@Serializable(with = PollSerializer::class)
data class QuizPoll(val id: PollId, val question: String, val textSources: List<TextSource> = emptyList(), val options: List<PollOption>, val votesCount: Int, val correctOptionIds: List<Int>? = null, val explanation: String?, val explanationTextSources: List<TextSource> = emptyList(), val isClosed: Boolean = false, val isAnonymous: Boolean = false, val allowsMultipleAnswers: Boolean = false, val allowsRevoting: Boolean = false, val scheduledCloseInfo: ScheduledCloseInfo? = null, val descriptionTextSources: List<TextSource> = emptyList(), val media: PollMedia? = null, val explanationMedia: PollMedia? = null, val membersOnly: Boolean = false, val countryCodes: List<String>? = null) : Poll(source)

Constructors

Link copied to clipboard
constructor(id: PollId, question: String, textSources: List<TextSource> = emptyList(), options: List<PollOption>, votesCount: Int, correctOptionIds: List<Int>? = null, explanation: String?, explanationTextSources: List<TextSource> = emptyList(), isClosed: Boolean = false, isAnonymous: Boolean = false, allowsMultipleAnswers: Boolean = false, allowsRevoting: Boolean = false, scheduledCloseInfo: ScheduledCloseInfo? = null, descriptionTextSources: List<TextSource> = emptyList(), media: PollMedia? = null, explanationMedia: PollMedia? = null, membersOnly: Boolean = false, countryCodes: List<String>? = null)

Properties

Link copied to clipboard
open override val allowsMultipleAnswers: Boolean
Link copied to clipboard
open override val allowsRevoting: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val countryCodes: List<String>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val id: PollId
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val isAnonymous: Boolean
Link copied to clipboard
open override val isClosed: Boolean
Link copied to clipboard
open override val media: PollMedia?
Link copied to clipboard
open override val membersOnly: Boolean
Link copied to clipboard
Link copied to clipboard
open override val options: List<PollOption>
Link copied to clipboard
open override val question: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val text: String
Link copied to clipboard
open override val textSources: List<TextSource>

Full list of TextSources

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val votesCount: Int

Functions

Link copied to clipboard
inline fun Poll.asQuizPoll(): QuizPoll?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Poll.createRequest(chatId: ChatIdentifier, threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, media: InputPollMedia? = null, membersOnly: Boolean = false, countryCodes: List<String>? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null): SendPoll
Link copied to clipboard
inline fun <T> Poll.ifQuizPoll(block: (QuizPoll) -> T): T?
Link copied to clipboard
inline fun <T> Poll.ifRegularPoll(block: (RegularPoll) -> T): T?
Link copied to clipboard
inline fun <T> Poll.ifUnknownPollType(block: (UnknownPollType) -> T): T?
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:

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> Poll.whenQuizPoll(block: (QuizPoll) -> T): T?
Link copied to clipboard
inline fun <T> Poll.whenRegularPoll(block: (RegularPoll) -> T): T?
Link copied to clipboard
inline fun <T> Poll.whenUnknownPollType(block: (UnknownPollType) -> T): T?