Poll

class Poll()

A poll attached to a message, including its choices, vote counts, expiration, and finalization state.

exported from lib.weeble.d

Properties

Poll.allowMultiselect

type: readonly boolean

Indicates whether members can select multiple answers.

Poll.answers

type: readonly { answerId: number; count: number; meVoted: boolean; text: string; }[]

Array of answer options with their vote counts.

Poll.channelId

type: readonly string | null

ID of the channel containing this poll, or null when the poll is not attached to a message.

Poll.expiration

type: readonly Date | null

When the poll expires, or null if no expiration is set.

Poll.layoutType

type: readonly number

Underlying Discord poll layout type identifier.

Poll.messageId

type: readonly string | null

ID of the message containing this poll, or null when the poll is not attached to a message.

Poll.question

type: readonly { text: string; }

The question prompt for this poll.

Poll.results

type: readonly { answerCounts: { count: number; id: number; }[]; isFinalized: boolean; } | null

Aggregated results, or null when 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 null when Discord omitted poll results.

Poll.getVoteCount(answerId: number) number | null

Get the vote count for a specific answer ID.

Parameters:
  • answerId — – The numeric ID of the answer choice.

Returns:

The answer’s vote count, or null when Discord omitted poll results.

Poll.isFinalized() boolean

Indicates whether the poll results are finalized (no more voting).

Returns:

true if the poll results have been published and voting has ended.