MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / send_poll

Method send_poll

src/telegram/_bot.py:7371–7661  ·  view source on GitHub ↗

Use this method to send a native poll. Args: chat_id (:obj:`int` | :obj:`str`): |chat_id_channel| question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`- :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.

(
        self,
        chat_id: int | str,
        question: str,
        options: Sequence["str | InputPollOption"],
        is_anonymous: bool | None = None,
        type: str | None = None,  # pylint: disable=redefined-builtin
        allows_multiple_answers: bool | None = None,
        # tags: deprecated in 22.8, to be removed
        # replaced by `correct_option_ids`
        correct_option_id: CorrectOptionID | None = None,
        is_closed: bool | None = None,
        disable_notification: ODVInput[bool] = DEFAULT_NONE,
        reply_markup: "ReplyMarkup | None" = None,
        explanation: str | None = None,
        explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
        open_period: TimePeriod | None = None,
        close_date: int | dtm.datetime | None = None,
        explanation_entities: Sequence["MessageEntity"] | None = None,
        protect_content: ODVInput[bool] = DEFAULT_NONE,
        message_thread_id: int | None = None,
        reply_parameters: "ReplyParameters | None" = None,
        business_connection_id: str | None = None,
        question_parse_mode: ODVInput[str] = DEFAULT_NONE,
        question_entities: Sequence["MessageEntity"] | None = None,
        message_effect_id: str | None = None,
        allow_paid_broadcast: bool | None = None,
        allows_revoting: bool | None = None,
        allow_adding_options: bool | None = None,
        hide_results_until_closes: bool | None = None,
        correct_option_ids: CorrectOptionIds | None = None,
        description: str | None = None,
        description_parse_mode: ODVInput[str] | None = None,
        description_entities: Sequence["MessageEntity"] | None = None,
        shuffle_options: bool | None = None,
        members_only: bool | None = None,
        country_codes: Sequence[str] | None = None,
        explanation_media: "InputPollMedia | None" = None,
        media: "InputPollMedia | None" = None,
        *,
        allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
        reply_to_message_id: int | None = None,
        read_timeout: ODVInput[float] = DEFAULT_NONE,
        write_timeout: ODVInput[float] = DEFAULT_NONE,
        connect_timeout: ODVInput[float] = DEFAULT_NONE,
        pool_timeout: ODVInput[float] = DEFAULT_NONE,
        api_kwargs: JSONDict | None = None,
    )

Source from the content-addressed store, hash-verified

7369 )
7370
7371 async def send_poll(
7372 self,
7373 chat_id: int | str,
7374 question: str,
7375 options: Sequence["str | InputPollOption"],
7376 is_anonymous: bool | None = None,
7377 type: str | None = None, # pylint: disable=redefined-builtin
7378 allows_multiple_answers: bool | None = None,
7379 # tags: deprecated in 22.8, to be removed
7380 # replaced by `correct_option_ids`
7381 correct_option_id: CorrectOptionID | None = None,
7382 is_closed: bool | None = None,
7383 disable_notification: ODVInput[bool] = DEFAULT_NONE,
7384 reply_markup: "ReplyMarkup | None" = None,
7385 explanation: str | None = None,
7386 explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
7387 open_period: TimePeriod | None = None,
7388 close_date: int | dtm.datetime | None = None,
7389 explanation_entities: Sequence["MessageEntity"] | None = None,
7390 protect_content: ODVInput[bool] = DEFAULT_NONE,
7391 message_thread_id: int | None = None,
7392 reply_parameters: "ReplyParameters | None" = None,
7393 business_connection_id: str | None = None,
7394 question_parse_mode: ODVInput[str] = DEFAULT_NONE,
7395 question_entities: Sequence["MessageEntity"] | None = None,
7396 message_effect_id: str | None = None,
7397 allow_paid_broadcast: bool | None = None,
7398 allows_revoting: bool | None = None,
7399 allow_adding_options: bool | None = None,
7400 hide_results_until_closes: bool | None = None,
7401 correct_option_ids: CorrectOptionIds | None = None,
7402 description: str | None = None,
7403 description_parse_mode: ODVInput[str] | None = None,
7404 description_entities: Sequence["MessageEntity"] | None = None,
7405 shuffle_options: bool | None = None,
7406 members_only: bool | None = None,
7407 country_codes: Sequence[str] | None = None,
7408 explanation_media: "InputPollMedia | None" = None,
7409 media: "InputPollMedia | None" = None,
7410 *,
7411 allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
7412 reply_to_message_id: int | None = None,
7413 read_timeout: ODVInput[float] = DEFAULT_NONE,
7414 write_timeout: ODVInput[float] = DEFAULT_NONE,
7415 connect_timeout: ODVInput[float] = DEFAULT_NONE,
7416 pool_timeout: ODVInput[float] = DEFAULT_NONE,
7417 api_kwargs: JSONDict | None = None,
7418 ) -> Message:
7419 """
7420 Use this method to send a native poll.
7421
7422 Args:
7423 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
7424 question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
7425 :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
7426 options (Sequence[:obj:`str` | :class:`telegram.InputPollOption`]): Sequence of
7427 :tg-const:`telegram.Poll.MIN_OPTION_NUMBER`-
7428 :tg-const:`telegram.Poll.MAX_OPTION_NUMBER` answer options. Each option may either

Calls 4

_send_messageMethod · 0.95
warnFunction · 0.90
InputPollOptionClass · 0.90