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.

questionEntities?: MessageEntity[]

The entities of the poll’s question.

questionParseMode?: ParseMode

The parse mode to use for the poll’s question. If not provided, the default parse mode will be used.

optionParseMode?: ParseMode

The parse mode to use for the poll’s options. If not provided, the default parse mode will be used.

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.

replyTo?: ReplyTo

Information on what the message is replying to.

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.

effectId?: number

The identifier of a message effect to be attached to the message.

sendAt?: Date

If specified, the message will be scheduled to be sent at that date. User-only.

businessConnectionId?: string

The identifier of a business connection ID to perform the action on. Bot-only.

paidBroadcast?: boolean
replyMarkup?: ReplyMarkup

The reply markup of the message. Bot-only.

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, {
    questionEntities,
    questionParseMode,
    optionParseMode,
    isAnonymous,
    type,
    allowMultipleAnswers,
    correctOptionIndex,
    explanation,
    explanationParseMode,
    explanationEntities,
    openPeriod,
    closeDate,
    isClosed,
    disableNotification,
    protectContent,
    replyTo,
    messageThreadId,
    sendAs,
    effectId,
    sendAt,
    businessConnectionId,
    paidBroadcast,
    replyMarkup,
});