Message.answer_poll()

async Message.answer_poll()[source]

Shortcut for method send_poll will automatically fill method attributes:

  • chat_id

  • message_thread_id

  • business_connection_id

Example

await message.answer_poll("This is a poll", ["A", "B", "C"])
Parameters:
  • question (str | FormattedText) – Poll question, 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users.

  • options (List of InputPollOption) – List of 1-12 answer options, each 1-100 characters.

  • description (str | FormattedText, optional) – Description of the poll to be sent, 0-1024 characters after entities parsing.

  • description_media (InputPollMedia, optional) – Media attached to the poll.

  • message_thread_id (int, optional) – Unique identifier for the target message thread (topic) of the forum. For supergroups only.

  • business_connection_id (str, optional) – Unique identifier of the business connection on behalf of which the message will be sent.

  • is_anonymous (bool, optional) – True, if the poll needs to be anonymous. Defaults to True.

  • type ( – obj`~pyrogram.enums.PollType`, optional): Poll type, QUIZ or REGULAR. Defaults to REGULAR.

  • allows_multiple_answers (bool, optional) – Pass True, if the poll allows multiple answers. Defaults to False.

  • allows_revoting (bool, optional) – Pass True, if the poll allows to change chosen answer options. Defaults to False for quizzes and to True for regular polls.

  • members_only (bool, optional) – 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 (List of str, optional) – The 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. If omitted or empty, then users from any country can participate in the poll.

  • shuffle_options (bool, optional) – Pass True, if the poll options must be shown in random order.

  • allow_adding_options (bool, optional) – Pass True, if answer options can be added to the poll after creation, not supported for anonymous polls and quizzes.

  • hide_results_until_closes (bool, optional) – Pass True, if poll results must be shown only after the poll closes.

  • correct_option_ids (List of int, optional) – List of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode.

  • explanation (str | FormattedText, optional) – 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_media (InputPollMedia, optional) – Media attached to the explanation.

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

  • close_date (datetime, optional) – Point in time 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 (bool, optional) – Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. For bots only.

  • disable_notification (bool, optional) – Sends the message silently. Users will receive a notification with no sound.

  • protect_content (bool, optional) – Protects the contents of the sent message from forwarding and saving.

  • allow_paid_broadcast (bool, optional) – If True, you will be allowed to send up to 1000 messages per second. Ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot’s balance. For bots only.

  • effect_id (int, optional) – Unique identifier of the message effect. For private chats only.

  • reply_parameters (ReplyParameters, optional) – Describes reply parameters for the message that is being sent.

  • schedule_date (datetime, optional) – Date when the message will be automatically sent.

  • repeat_period (int, optional) – Period after which the message will be sent again in seconds.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the messages.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

Returns:

On success, the sent Message is returned.

Raises:

RPCError – In case of a Telegram RPC error.