class Poll

This object contains information about a poll.

Methods

__construct(string $id, string $question, PollOption[] $options, int $total_voter_count, bool $is_closed, bool $is_anonymous, string $type, bool $allows_multiple_answers, int|null $correct_option_id = null, string|null $explanation = null, MessageEntity[]|null $explanation_entities = null, int|null $open_period = null, int|null $close_date = null)

No description

string
getId()

Unique poll identifier.

string
getQuestion()

Poll question, 1-300 characters.

array
getOptions()

List of poll options.

int
getTotalVoterCount()

Total number of users that voted in the poll.

bool
getIsClosed()

True, if the poll is closed.

bool
getIsAnonymous()

True, if the poll is anonymous.

string
getType()

Poll type, currently can be “regular” or “quiz”.

bool
getAllowsMultipleAnswers()

True, if the poll allows multiple answers.

int|null
getCorrectOptionId()

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.

string|null
getExplanation()

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.

array|null
getExplanationEntities()

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

int|null
getOpenPeriod()

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

int|null
getCloseDate()

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

Details

at line 25
__construct(string $id, string $question, PollOption[] $options, int $total_voter_count, bool $is_closed, bool $is_anonymous, string $type, bool $allows_multiple_answers, int|null $correct_option_id = null, string|null $explanation = null, MessageEntity[]|null $explanation_entities = null, int|null $open_period = null, int|null $close_date = null)

No description

Parameters

string $id
string $question
PollOption[] $options
int $total_voter_count
bool $is_closed
bool $is_anonymous
string $type
bool $allows_multiple_answers
int|null $correct_option_id
string|null $explanation
MessageEntity[]|null $explanation_entities
int|null $open_period
int|null $close_date

at line 45
string getId()

Unique poll identifier.

Return Value

string

at line 53
string getQuestion()

Poll question, 1-300 characters.

Return Value

string

at line 63
array getOptions()

List of poll options.

Return Value

array

at line 71
int getTotalVoterCount()

Total number of users that voted in the poll.

Return Value

int

at line 79
bool getIsClosed()

True, if the poll is closed.

Return Value

bool

at line 87
bool getIsAnonymous()

True, if the poll is anonymous.

Return Value

bool

at line 95
string getType()

Poll type, currently can be “regular” or “quiz”.

Return Value

string

at line 103
bool getAllowsMultipleAnswers()

True, if the poll allows multiple answers.

Return Value

bool

at line 111
int|null getCorrectOptionId()

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.

Return Value

int|null

at line 119
string|null getExplanation()

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.

Return Value

string|null

at line 129
array|null getExplanationEntities()

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

Return Value

array|null

at line 137
int|null getOpenPeriod()

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

Return Value

int|null

at line 145
int|null getCloseDate()

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

Return Value

int|null