Skip to content

class Tourmaline::Poll
inherits Reference #

This object contains information about a poll.

Included modules

JSON::Serializable

Constructors#

.new(id, question, total_voter_count, is_closed, is_anonymous, type, allows_multiple_answers, options : Array(Tourmaline::PollOption) = [] of Tourmaline::PollOption, question_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, correct_option_id : Int32 | Int64 | Nil = nil, explanation : String? = nil, explanation_entities : Array(Tourmaline::MessageEntity) = [] of Tourmaline::MessageEntity, open_period : Int32 | Int64 | Nil = nil, close_date : Int32 | Int64 | Nil = nil) #

View source

.new(pull : JSON::PullParser) #

View source

Methods#

#allows_multiple_answers=(allows_multiple_answers : Bool) #

True, if the poll allows multiple answers

View source

#allows_multiple_answers? : Bool #

True, if the poll allows multiple answers

View source

#close_date : Time? #

View source

#close_date=(close_date : Time?) #

View source

#correct_option_id : Int32 | Int64 | Nil #

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.

View source

#correct_option_id=(correct_option_id : Int32 | Int64 | Nil) #

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.

View source

#explanation : String? #

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

View source

#explanation=(explanation : String?) #

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

View source

#explanation_entities : Array(Tourmaline::MessageEntity) #

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

View source

#explanation_entities=(explanation_entities : Array(Tourmaline::MessageEntity)) #

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

View source

#id : String #

Unique poll identifier

View source

#id=(id : String) #

Unique poll identifier

View source

#is_anonymous=(is_anonymous : Bool) #

True, if the poll is anonymous

View source

#is_anonymous? : Bool #

True, if the poll is anonymous

View source

#is_closed=(is_closed : Bool) #

True, if the poll is closed

View source

#is_closed? : Bool #

True, if the poll is closed

View source

#open_period : Int32 | Int64 | Nil #

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

View source

#open_period=(open_period : Int32 | Int64 | Nil) #

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

View source

#options : Array(Tourmaline::PollOption) #

List of poll options

View source

#options=(options : Array(Tourmaline::PollOption)) #

List of poll options

View source

#question : String #

Poll question, 1-300 characters

View source

#question=(question : String) #

Poll question, 1-300 characters

View source

#question_entities : Array(Tourmaline::MessageEntity) #

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

View source

#question_entities=(question_entities : Array(Tourmaline::MessageEntity)) #

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

View source

#total_voter_count : Int32 | Int64 #

Total number of users that voted in the poll

View source

#total_voter_count=(total_voter_count : Int32 | Int64) #

Total number of users that voted in the poll

View source

#type : String #

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

View source

#type=(type : String) #

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

View source