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

Method send_media_group

src/telegram/_bot.py:2808–2989  ·  view source on GitHub ↗

Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. Note: If you supply a :paramref:`caption` (along with either :paramref:`parse_mode` or

(
        self,
        chat_id: int | str,
        media: Sequence[
            "InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo | InputMediaLivePhoto"  # noqa: E501  # pylint: disable=line-too-long
        ],
        disable_notification: ODVInput[bool] = DEFAULT_NONE,
        protect_content: ODVInput[bool] = DEFAULT_NONE,
        message_thread_id: int | None = None,
        reply_parameters: "ReplyParameters | None" = None,
        business_connection_id: str | None = None,
        message_effect_id: str | None = None,
        allow_paid_broadcast: bool | None = None,
        direct_messages_topic_id: int | 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,
        caption: str | None = None,
        parse_mode: ODVInput[str] = DEFAULT_NONE,
        caption_entities: Sequence["MessageEntity"] | None = None,
    )

Source from the content-addressed store, hash-verified

2806 )
2807
2808 async def send_media_group(
2809 self,
2810 chat_id: int | str,
2811 media: Sequence[
2812 "InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo | InputMediaLivePhoto" # noqa: E501 # pylint: disable=line-too-long
2813 ],
2814 disable_notification: ODVInput[bool] = DEFAULT_NONE,
2815 protect_content: ODVInput[bool] = DEFAULT_NONE,
2816 message_thread_id: int | None = None,
2817 reply_parameters: "ReplyParameters | None" = None,
2818 business_connection_id: str | None = None,
2819 message_effect_id: str | None = None,
2820 allow_paid_broadcast: bool | None = None,
2821 direct_messages_topic_id: int | None = None,
2822 *,
2823 allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
2824 reply_to_message_id: int | None = None,
2825 read_timeout: ODVInput[float] = DEFAULT_NONE,
2826 write_timeout: ODVInput[float] = DEFAULT_NONE,
2827 connect_timeout: ODVInput[float] = DEFAULT_NONE,
2828 pool_timeout: ODVInput[float] = DEFAULT_NONE,
2829 api_kwargs: JSONDict | None = None,
2830 caption: str | None = None,
2831 parse_mode: ODVInput[str] = DEFAULT_NONE,
2832 caption_entities: Sequence["MessageEntity"] | None = None,
2833 ) -> tuple[Message, ...]:
2834 """Use this method to send a group of photos, videos, documents or audios as an album.
2835 Documents and audio files can be only grouped in an album with messages of the same type.
2836
2837 Note:
2838 If you supply a :paramref:`caption` (along with either :paramref:`parse_mode` or
2839 :paramref:`caption_entities`), then items in :paramref:`media` must have no captions,
2840 and vice versa.
2841
2842 .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
2843
2844 .. versionchanged:: 20.0
2845 Returns a tuple instead of a list.
2846
2847 Args:
2848 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
2849 media (Sequence[:class:`telegram.InputMediaAudio`,\
2850 :class:`telegram.InputMediaDocument`, :class:`telegram.InputMediaPhoto`,\
2851 :class:`telegram.InputMediaVideo`, :class:`telegram.InputMediaLivePhoto`]): An
2852 array describing messages to be sent, must include
2853 :tg-const:`telegram.constants.MediaGroupLimit.MIN_MEDIA_LENGTH`-
2854 :tg-const:`telegram.constants.MediaGroupLimit.MAX_MEDIA_LENGTH` items.
2855
2856 .. versionchanged:: 20.0
2857 |sequenceargs|
2858 disable_notification (:obj:`bool`, optional): |disable_notification|
2859 protect_content (:obj:`bool`, optional): |protect_content|
2860
2861 .. versionadded:: 13.10
2862 message_thread_id (:obj:`int`, optional): |message_thread_id_arg|
2863
2864 .. versionadded:: 20.0
2865

Calls 6

_postMethod · 0.95
parse_sequence_argFunction · 0.90
ReplyParametersClass · 0.90
copyMethod · 0.80
_unfrozenMethod · 0.80
de_listMethod · 0.80