peyk.platforms.telegram.methods.send_poll

async peyk.platforms.telegram.methods.send_poll(self, chat_id: int | str, question: str, options: Sequence[str | InputPollOption], *, message_thread_id: int | None = None, question_parse_mode: str | None = None, question_entities: Sequence[MessageEntity | Mapping[str, object]] | None = None, is_anonymous: bool | None = None, type: str | None = None, allows_multiple_answers: bool | None = None, allows_revoting: bool | None = None, shuffle_options: bool | None = None, allow_adding_options: bool | None = None, hide_results_until_closes: bool | None = None, members_only: bool | None = None, country_codes: Sequence[str] | None = None, correct_option_ids: Sequence[int] | None = None, explanation: str | None = None, explanation_parse_mode: str | None = None, explanation_entities: Sequence[MessageEntity | Mapping[str, object]] | None = None, explanation_media: InputMediaPhoto | InputMediaVideo | InputMediaAnimation | InputMediaAudio | InputMediaDocument | InputMediaLivePhoto | InputMediaLocation | InputMediaVenue | Mapping[str, object] | None = None, open_period: int | None = None, close_date: int | None = None, is_closed: bool | None = None, description: str | None = None, description_parse_mode: str | None = None, description_entities: Sequence[MessageEntity | Mapping[str, object]] | None = None, media: InputMediaPhoto | InputMediaVideo | InputMediaAnimation | InputMediaAudio | InputMediaDocument | InputMediaLivePhoto | InputMediaLocation | InputMediaVenue | Mapping[str, object] | None = None, disable_notification: bool | None = None, protect_content: bool | None = None, reply_parameters: ReplyParameters | Mapping[str, object] | None = None, reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply | Mapping[str, object] | None = None) Message[source]

Use this method to send a native poll. On success, the sent Message is returned.

Parameters:
  • chat_id – Unique identifier for the target chat or username of the target bot, supergroup or channel in the format @username. Polls can’t be sent to channel direct messages chats.

  • question – Poll question, 1-300 characters

  • options – A JSON-serialized list of 1-12 answer options

  • message_thread_id – Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only

  • question_parse_mode – Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed.

  • question_entities – A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode.

  • is_anonymous – True, if the poll needs to be anonymous, defaults to True

  • type – Poll type, ‘quiz’ or ‘regular’, defaults to ‘regular’

  • allows_multiple_answers – Pass True if the poll allows multiple answers, defaults to False

  • allows_revoting – Pass True if the poll allows to change chosen answer options, defaults to False for quizzes and to True for regular polls

  • shuffle_options – Pass True if the poll options must be shown in random order

  • allow_adding_options – Pass True if answer options can be added to the poll after creation; not supported for anonymous polls and quizzes

  • hide_results_until_closes – Pass True if poll results must be shown only after the poll closes

  • members_only – Pass True if voting is limited to users who have been members of the chat where the poll is being sent for more than 24 hours; for channel chats only

  • country_codes – A JSON-serialized list of 0-12 two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which users can vote in the poll; for channel chats only. Use ‘FT’ as a country code to allow users with anonymous numbers to vote. If omitted or empty, then users from any country can participate in the poll.

  • correct_option_ids – A JSON-serialized list of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode

  • explanation – 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 with at most 2 line feeds after entities parsing

  • explanation_parse_mode – Mode for parsing entities in the explanation. See formatting options for more details.

  • explanation_entities – A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode.

  • explanation_media – Media added to the quiz explanation

  • open_period – Amount of time in seconds the poll will be active after creation, 5-2628000. Can’t be used together with close_date.

  • close_date – Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can’t be used together with open_period.

  • is_closed – Pass True if the poll needs to be immediately closed. This can be useful for poll preview.

  • description – Description of the poll to be sent, 0-1024 characters after entities parsing

  • description_parse_mode – Mode for parsing entities in the poll description. See formatting options for more details.

  • description_entities – A JSON-serialized list of special entities that appear in the poll description, which can be specified instead of description_parse_mode

  • media – Media added to the poll description

  • disable_notification – Sends the message silently. Users will receive a notification with no sound.

  • protect_content – Protects the contents of the sent message from forwarding and saving

  • reply_parameters – Description of the message to reply to

  • reply_markup – Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.

Returns:

Result returned by Telegram on successful execution.

Return type:

Message