
Poll Object
The poll object has a lot of levels and nested structures. It was also designed to support future extensibility, so some fields may appear to be more complex than necessary.Poll Object Structure
expiry is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently.
Poll Create Request Object
This is the request object used when creating a poll across the different endpoints. It is similar but not exactly identical to the main poll object. The main difference is that the request hasduration which eventually becomes expiry.
Poll Create Request Object Structure
Layout Type
We might have different layouts for polls in the future. For now though, this number will be 1.Poll Media Object
The poll media object is a common object that backs both the question and answers. The intention is that it allows us to extensibly add new ways to display things in the future. For now,question only supports text, while answers can have an optional emoji.
Poll Media Object Structure
text should always be non-null for both questions and answers, but please do not depend on that in the future.
The maximum length of text is 300 for the question, and 55 for any answer.
When creating a poll answer with an emoji, one only needs to send either the id (custom emoji) or name (default emoji) as the only field.
Poll Answer Object
Theanswer_id is a number that labels each answer.
As an implementation detail, it currently starts at 1 for the first answer and goes up sequentially.
We recommend against depending on this sequence.
Currently, there is a maximum of 10 answers per poll.
Poll Answer Object Structure
* Only sent as part of responses from Discord’s API/Gateway.
Poll Results Object
In a nutshell, this contains the number of votes for each answer. Theresults field may be not present in certain responses where, as an implementation detail, we do not fetch the poll results in our backend.
This should be treated as “unknown results”, as opposed to “no results”. You can keep using the results if you have previously received them through other means.
Also due to the intricacies of counting at scale, while a poll is in progress the results may not be perfectly accurate.
They usually are accurate, and shouldn’t deviate significantly — it’s just difficult to make guarantees.
To compensate for this, after a poll is finished there is a background job which performs a final, accurate tally of votes.
This tally concludes once is_finalized is true. Polls that have ended will also always contain results.
If answer_counts does not contain an entry for a particular answer, then there are no votes for that answer.