Class Poll

Hierarchy (view full)

Constructors

Properties

allowAnswers: boolean

True, if the poll allows multiple answers

anonymous: boolean

True, if the poll is anonymous

closeUnixTime?: number

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

closed: boolean

True, if the poll is closed

correctId?: number

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

explanation?: string

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

explanationEntities?: MessageEntities

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

id: string

Unique poll identifier

openPeriod?: number

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

options?: {
    entities: MessageEntities;
    text: string;
    voterCount: number;
}[]

List of poll options

Type declaration

  • entities: MessageEntities
    • Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts
  • text: string
    • Option text, 1-100 characters
  • voterCount: number
    • Number of users that voted for this option
question: string

Poll question, 1-300 characters

questionEntities?: MessageEntities

Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions

totalVoterCount: number

Total number of users that voted in the poll

type: "quiz" | "regular"

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

Accessors

  • get closeTimestamp(): null | number
  • Return the timestamp poll will be automatically closed, in milliseconds

    Returns null | number

  • get closedAt(): null | Date
  • Point in time when the poll will be automatically closed

    Returns null | Date

Methods

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance