Poll
- class Poll
A poll attached to a message, including its choices, vote counts, expiration, and finalization state.
Properties
Property
Type
Description
allowMultiselectIndicates whether members can select multiple answers.
answers{ answerId: number; count: number; meVoted: boolean; text: string; }[]
Array of answer options with their vote counts.
channelIdID of the channel containing this poll, or
nullwhen the poll is not attached to a message.expirationWhen the poll expires, or
nullif no expiration is set.layoutTypeUnderlying Discord poll layout type identifier.
messageIdID of the message containing this poll, or
nullwhen the poll is not attached to a message.question{ text: string; }
The question prompt for this poll.
results{ answerCounts: { count: number; id: number; }[]; isFinalized: boolean; } | null
Aggregated results, or
nullwhen Discord omitted them.Methods
-
async Poll.fetchVoters(answerId: number, options: { after?: string; limit?: number; }) Promise<
User[]> Fetch users who voted for one answer.
- Poll.getTotalVotes() number | null
Get the total number of votes cast across all answers.
- Returns:
The sum of votes, or
nullwhen Discord omitted poll results.
-
async Poll.fetchVoters(answerId: number, options: { after?: string; limit?: number; }) Promise<