Poll

@Serializable
data class Poll(val id: String, val question: String, val options: List<PollOption>, val questionEntities: List<MessageEntity>? = null, val totalVoterCount: Int, val isClosed: Boolean, val isAnonymous: Boolean, val type: PollType, val allowsMultipleAnswers: Boolean, val correctOptionId: Int? = null, val explanation: String? = null, val explanationEntities: List<MessageEntity>? = null, val openPeriod: Int? = null, val closeDate: Instant? = null)

This object contains information about a poll.

Api reference

Constructors

Link copied to clipboard
constructor(id: String, question: String, options: List<PollOption>, questionEntities: List<MessageEntity>? = null, totalVoterCount: Int, isClosed: Boolean, isAnonymous: Boolean, type: PollType, allowsMultipleAnswers: Boolean, correctOptionId: Int? = null, explanation: String? = null, explanationEntities: List<MessageEntity>? = null, openPeriod: Int? = null, closeDate: Instant? = null)

Properties

Link copied to clipboard

True, if the poll allows multiple answers

Link copied to clipboard
@Serializable(with = InstantSerializer::class)
val closeDate: Instant? = null

Optional. Point in time (Unix timestamp) when the poll will be automatically closed

Link copied to clipboard
val correctOptionId: Int? = null

Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.

Link copied to clipboard
val explanation: String? = null

Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters

Link copied to clipboard

Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation

Link copied to clipboard
val id: String

Unique poll identifier

Link copied to clipboard

True, if the poll is anonymous

Link copied to clipboard

True, if the poll is closed

Link copied to clipboard
val openPeriod: Int? = null

Optional. Amount of time in seconds the poll will be active after creation

Link copied to clipboard

List of poll options

Link copied to clipboard

Poll question, 1-300 characters

Link copied to clipboard

Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions

Link copied to clipboard

Total number of users that voted in the poll

Link copied to clipboard

Poll type, currently can be "regular" or "quiz"