Link Search Menu Expand Document

Constructor: poll

Back to constructors index

Poll

Attributes:

NameTypeRequiredDescription
idlongYesID of the poll
closedBoolOptionalWhether the poll is closed and doesn’t accept any more answers
public_votersBoolOptionalWhether cast votes are publicly visible to all users (non-anonymous poll)
multiple_choiceBoolOptionalWhether multiple options can be chosen as answer
quizBoolOptionalWhether this is a quiz (with wrong and correct answers, results shown in the return type)
open_answersBoolOptional
revoting_disabledBoolOptional
shuffle_answersBoolOptional
hide_results_until_closeBoolOptional
creatorBoolOptional
questionTextWithEntitiesYesThe question of the poll (only Premium users can use custom emoji entities here).
answersArray of PollAnswerYesThe possible answers (2-poll_answers_max), vote using messages.sendVote.
close_periodintOptionalAmount of time in seconds the poll will be active after creation, 5-600. Can’t be used together with close_date.
close_dateintOptionalPoint in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future; can’t be used together with close_period.
hashlongYes

Type: Poll

Example:

$poll = ['_' => 'poll', 'id' => long, 'closed' => Bool, 'public_voters' => Bool, 'multiple_choice' => Bool, 'quiz' => Bool, 'open_answers' => Bool, 'revoting_disabled' => Bool, 'shuffle_answers' => Bool, 'hide_results_until_close' => Bool, 'creator' => Bool, 'question' => TextWithEntities, 'answers' => [PollAnswer, PollAnswer], 'close_period' => int, 'close_date' => int, 'hash' => long];