sendPoll

Send a poll.

PARAMETERS
chatId: ID

The chat to send the poll to.

question: string

The poll’s question.

options: [string, string, ...string[]]

The poll’s options.

isAnonymous?: boolean

Whether the poll should be anonymous.

type?: "quiz" | "regular"

The type of the poll.

allowMultipleAnswers?: boolean

Whether multiple selections should be allowed. Only valid for regular polls.

correctOptionIndex?: number

Index of the correct option. Required for quiz polls.

explanation?: string

A text that will be shown to the user when the poll is answered. Only valid for quiz polls.

explanationParseMode?: ParseMode

The parse mode to use for the explanation. If not provided, the default parse mode will be used.

explanationEntities?: MessageEntity[]

The explanation’s entities.

openPeriod?: number

Duration of the poll in seconds. Must be in the range of 5-600. Cannot be used simultaneously with closeDate.

closeDate?: Date

The time in which the poll will be closed. Must be at least 5 seconds in the future, and no more than 600. Cannot be used simultaneously with openPeriod.

isClosed?: boolean

Whether the poll should be closed as soon as it is sent, allowing no answers.

disableNotification?: boolean

Whether to send the message in a silent way without making a sound on the recipients’ clients.

protectContent?: boolean

Whether to protect the contents of the message from copying and forwarding.

replyToMessageId?: number

The identifier of a message to reply to.

replyQuote?: ReplyQuote

A specific part of the replying message’s text to quote.

messageThreadId?: number

The identifier of a thread to send the message to.

sendAs?: ID

The identifier of a chat to send the message on behalf of. User-only.

replyMarkup?: ReplyMarkup

The reply markup of the message. Bot-only.

businessConnectionId?: string
RESULT

The sent poll.

SYNTAX
// Required parameters only.
await client.sendPoll(chatId, question, options);

// Required parameters + optional parameters.
// Any of the optional parameters can be omitted.
await client.sendPoll(chatId, question, options, {
    isAnonymous,
    type,
    allowMultipleAnswers,
    correctOptionIndex,
    explanation,
    explanationParseMode,
    explanationEntities,
    openPeriod,
    closeDate,
    isClosed,
    disableNotification,
    protectContent,
    replyToMessageId,
    replyQuote,
    messageThreadId,
    sendAs,
    replyMarkup,
    businessConnectionId,
});