o
    "h                     @   s  d Z ddlZddlmZ ddlmZmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z)m*Z* ddl+m,Z, eeeeeef Z-G dd deZ.G dd deZ/G dd de/Z0G dd de/Z1G dd de.Z2G dd  d e.Z3G d!d" d"e.Z4G d#d$ d$e.Z5G d%d& d&e.Z6dS )'z+Base class for Telegram InputMedia Objects.    N)Sequence)FinalOptionalUnion)	constants)	Animation)Audio)Document)	InputFile)	PhotoSize)Video)MessageEntity)TelegramObject)enum)parse_sequence_argto_timedelta)get_timedelta_value)DEFAULT_NONEparse_file_input)	FileInputJSONDictODVInput
TimePeriod)InputMediaTypec                       s   e Zd ZdZdZddefdddedeeef de	e de	e
e  d	ee d
e	e f fddZede	e de	eeef  fddZ  ZS )
InputMediaa  
    Base class for Telegram InputMedia Objects.

    .. versionchanged:: 20.0
        Added arguments and attributes :attr:`type`, :attr:`media`, :attr:`caption`,
            :attr:`caption_entities`, :paramref:`parse_mode`.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    Args:
        media_type (:obj:`str`): Type of media that the instance represents.
        media (:obj:`str` | :class:`~telegram.InputFile`): File to send.
            |fileinputnopath|
        caption (:obj:`str`, optional): Caption of the media to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities
            parsing.
        caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|

            .. versionchanged:: 20.0
                |sequenceclassargs|

        parse_mode (:obj:`str`, optional): |parse_mode|

    Attributes:
        type (:obj:`str`): Type of the input media.
        media (:obj:`str` | :class:`telegram.InputFile`): Media to send.
        caption (:obj:`str`): Optional. Caption of the media to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities
            parsing.
        parse_mode (:obj:`str`): Optional. |parse_mode|
        caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|

            .. versionchanged:: 20.0

                * |tupleclassattrs|
                * |alwaystuple|

    )captioncaption_entitiesmedia
parse_modetypeN
api_kwargs
media_typer   r   r   r   r"   c                   sH   t  j|d ttj||| _|| _|| _t	|| _
|| _|   d S Nr!   )super__init__r   
get_memberr   r   r    r   r   r   r   r   _freeze)selfr#   r   r   r   r   r"   	__class__ M/var/www/html/venv/lib/python3.10/site-packages/telegram/_files/inputmedia.pyr&   V   s   

zInputMedia.__init__	thumbnailreturnc                 C   s   | d urt | dddS | S )NTattach
local_moder   )r.   r,   r,   r-   _parse_thumbnail_inputi   s
   z!InputMedia._parse_thumbnail_input)__name__
__module____qualname____doc__	__slots__r   strr   r
   r   r   r   r   r   r&   staticmethodr   r3   __classcell__r,   r,   r*   r-   r   ,   s.    '

,r   c                       sr   e Zd ZU dZejjZee e	d< 	 ejj
Z
ee e	d< 	 dZdddedeeef d	ee f fd
dZ  ZS )InputPaidMediaah  
    Base class for Telegram InputPaidMedia Objects. Currently, it can be one of:

    * :class:`telegram.InputPaidMediaPhoto`
    * :class:`telegram.InputPaidMediaVideo`

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    .. versionadded:: 21.4

    Args:
        type (:obj:`str`): Type of media that the instance represents.
        media (:obj:`str` | :class:`~telegram.InputFile`): File
            to send. |fileinputnopath|

    Attributes:
        type (:obj:`str`): Type of the input media.
        media (:obj:`str` | :class:`telegram.InputFile`): Media to send.
    PHOTOVIDEO)r   r    Nr!   r    r   r"   c                   s2   t  j|d ttj||| _|| _|   d S r$   )	r%   r&   r   r'   r   InputPaidMediaTyper    r   r(   )r)   r    r   r"   r*   r,   r-   r&      s   zInputPaidMedia.__init__)r4   r5   r6   r7   r   r?   r=   r   r9   __annotations__r>   r8   r   r
   r   r   r&   r;   r,   r,   r*   r-   r<   t   s   
 
r<   c                       s@   e Zd ZdZdZdddeeef dee	 f fddZ
  ZS )	InputPaidMediaPhotoa  The paid media to send is a photo.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    .. versionadded:: 21.4

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` |             :class:`pathlib.Path` | :class:`telegram.PhotoSize`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.PhotoSize` object to send.

    Attributes:
        type (:obj:`str`): Type of the media, always
            :tg-const:`telegram.constants.InputPaidMediaType.PHOTO`.
        media (:obj:`str` | :class:`telegram.InputFile`): Photo to send.
    r,   Nr!   r   r"   c                   s0   t |tddd}t jtj||d |   d S NTr0   )r    r   r"   )r   r   r%   r&   r<   r=   r(   )r)   r   r"   r*   r,   r-   r&      s   zInputPaidMediaPhoto.__init__)r4   r5   r6   r7   r8   r   r   r   r   r   r&   r;   r,   r,   r*   r-   rA      s    
rA   c                       s   e Zd ZdZdZ							ddddeeef dee dee	 dee	 d	ee
 d
ee dee dee	 dee f fddZedeee	ejf  fddZ  ZS )InputPaidMediaVideoa
  
    The paid media to send is a video.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    .. versionadded:: 21.4

    Note:
        *  When using a :class:`telegram.Video` for the :attr:`media` attribute, it will take the
           width, height and duration from that video, unless otherwise specified with the optional
           arguments.
        *  :paramref:`thumbnail` will be ignored for small video files, for which Telegram can
           easily generate thumbnails. However, this behaviour is undocumented and might be
           changed by Telegram.

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` |             :class:`pathlib.Path` | :class:`telegram.Video`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.Video` object to send.
        thumbnail (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): |thumbdocstringnopath|
        cover (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): Cover for the video in the message. |fileinputnopath|

            .. versionchanged:: 21.11
        start_timestamp (:obj:`int`, optional): Start timestamp for the video in the message

            .. versionchanged:: 21.11
        width (:obj:`int`, optional): Video width.
        height (:obj:`int`, optional): Video height.
        duration (:obj:`int` | :class:`datetime.timedelta`, optional): Video duration in seconds.

            .. versionchanged:: v22.2
                |time-period-input|
        supports_streaming (:obj:`bool`, optional): Pass :obj:`True`, if the uploaded video is
            suitable for streaming.

    Attributes:
        type (:obj:`str`): Type of the media, always
            :tg-const:`telegram.constants.InputPaidMediaType.VIDEO`.
        media (:obj:`str` | :class:`telegram.InputFile`): Video to send.
        thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|
        cover (:class:`telegram.InputFile`): Optional. Cover for the video in the message.
            |fileinputnopath|

            .. versionchanged:: 21.11
        start_timestamp (:obj:`int`): Optional. Start timestamp for the video in the message

            .. versionchanged:: 21.11
        width (:obj:`int`): Optional. Video width.
        height (:obj:`int`): Optional. Video height.
        duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Video duration in seconds.

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        supports_streaming (:obj:`bool`): Optional. :obj:`True`, if the uploaded video is
            suitable for streaming.
    )	_durationcoverheightstart_timestampsupports_streamingr.   widthNr!   r   r.   rI   rF   durationrH   rE   rG   r"   c	          
         s   t |tr$|d ur|n|j}|d ur|n|j}|d ur|n|j}|j}nt|ddd}t jt	j
||	d |  , t|| _|| _|| _t|| _|| _|rWt|dddnd | _|| _W d    d S 1 shw   Y  d S rB   )
isinstancer   rI   rF   rD   file_idr   r%   r&   r<   r>   	_unfrozenr   r3   r.   r   rH   rE   rG   )
r)   r   r.   rI   rF   rJ   rH   rE   rG   r"   r*   r,   r-   r&     s&   


"zInputPaidMediaVideo.__init__r/   c                 C      t | jddS NrJ   )	attributer   rD   r)   r,   r,   r-   rJ   (     zInputPaidMediaVideo.duration)NNNNNNN)r4   r5   r6   r7   r8   r   r   r   r   intr   boolr   r&   propertydtm	timedeltarJ   r;   r,   r,   r*   r-   rC      sB    ;
	%&rC   c                       s   e Zd ZdZdZdeddddddddf
dddeeef de	e
 dee
 de	e d	e	e d
e	e de	ee  de	e
 de	e de	e de	e de	e f fddZede	eeejf  fddZ  ZS )InputMediaAnimationaO  Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

    Note:
        When using a :class:`telegram.Animation` for the :attr:`media` attribute, it will take the
        width, height and duration from that animation, unless otherwise specified with the
        optional arguments.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    .. versionchanged:: 20.5
      |removed_thumb_note|

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` |             :class:`pathlib.Path` | :class:`telegram.Animation`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.Animation` object to send.

            .. versionchanged:: 13.2
               Accept :obj:`bytes` as input.
        filename (:obj:`str`, optional): Custom file name for the animation, when uploading a
            new file. Convenience parameter, useful e.g. when sending files generated by the
            :obj:`tempfile` module.

            .. versionadded:: 13.1
        caption (:obj:`str`, optional): Caption of the animation to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
            after entities parsing.
        parse_mode (:obj:`str`, optional): |parse_mode|
        caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|

            .. versionchanged:: 20.0
                |sequenceclassargs|

        width (:obj:`int`, optional): Animation width.
        height (:obj:`int`, optional): Animation height.
        duration (:obj:`int` | :class:`datetime.timedelta`, optional): Animation duration
            in seconds.

            .. versionchanged:: v22.2
                |time-period-input|
        has_spoiler (:obj:`bool`, optional): Pass :obj:`True`, if the animation needs to be covered
            with a spoiler animation.

            .. versionadded:: 20.0
        thumbnail (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): |thumbdocstringnopath|

            .. versionadded:: 20.2
        show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med|

            .. versionadded:: 21.3

    Attributes:
        type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.ANIMATION`.
        media (:obj:`str` | :class:`telegram.InputFile`): Animation to send.
        caption (:obj:`str`): Optional. Caption of the animation to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
            after entities parsing.
        parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
        caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|

            .. versionchanged:: 20.0

                * |tupleclassattrs|
                * |alwaystuple|
        width (:obj:`int`): Optional. Animation width.
        height (:obj:`int`): Optional. Animation height.
        duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Animation duration
            in seconds.

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the animation is covered with a
            spoiler animation.

            .. versionadded:: 20.0
        thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|

            .. versionadded:: 20.2
        show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med|

            .. versionadded:: 21.3
    )rD   has_spoilerrF   show_caption_above_mediar.   rI   Nr!   r   r   r   rI   rF   rJ   r   filenamerZ   r.   r[   r"   c                   s   t |tr$|d u r|jn|}|d u r|jn|}|d ur|n|j}|j}nt||ddd}t jt	j
|||||d |    | |
| _|| _|| _t|| _|	| _|| _W d    d S 1 s`w   Y  d S NTr\   r1   r2   r!   )rK   r   rI   rF   rD   rL   r   r%   r&   r   	ANIMATIONrM   r3   r.   r   rZ   r[   )r)   r   r   r   rI   rF   rJ   r   r\   rZ   r.   r[   r"   r*   r,   r-   r&     s0   


"zInputMediaAnimation.__init__r/   c                 C   rN   rO   rQ   rR   r,   r,   r-   rJ     rS   zInputMediaAnimation.duration)r4   r5   r6   r7   r8   r   r   r   r   r   r9   r   rT   r   r   r   rU   r   r&   rV   rW   rX   rJ   r;   r,   r,   r*   r-   rY   -  sT    T

	
,&rY   c                       s   e Zd ZdZdZdeddddfdddeeef de	e
 dee
 de	ee  d	e	e
 d
e	e de	e de	e f fddZ  ZS )InputMediaPhotoa9	  Represents a photo to be sent.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` |             :class:`pathlib.Path` | :class:`telegram.PhotoSize`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.PhotoSize` object to send.

            .. versionchanged:: 13.2
               Accept :obj:`bytes` as input.
        filename (:obj:`str`, optional): Custom file name for the photo, when uploading a
            new file. Convenience parameter, useful e.g. when sending files generated by the
            :obj:`tempfile` module.

            .. versionadded:: 13.1
        caption (:obj:`str`, optional ): Caption of the photo to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
            entities parsing.
        parse_mode (:obj:`str`, optional): |parse_mode|
        caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|

            .. versionchanged:: 20.0
                |sequenceclassargs|
        has_spoiler (:obj:`bool`, optional): Pass :obj:`True`, if the photo needs to be covered
            with a spoiler animation.

            .. versionadded:: 20.0
        show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med|

            .. versionadded:: 21.3

    Attributes:
        type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.PHOTO`.
        media (:obj:`str` | :class:`telegram.InputFile`): Photo to send.
        caption (:obj:`str`): Optional. Caption of the photo to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
            after entities parsing.
        parse_mode (:obj:`str`): Optional. |parse_mode|
        caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|

            .. versionchanged:: 20.0

                * |tupleclassattrs|
                * |alwaystuple|
        has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the photo is covered with a
            spoiler animation.

            .. versionadded:: 20.0
        show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med|

            .. versionadded:: 21.3
    )rZ   r[   Nr!   r   r   r   r   r\   rZ   r[   r"   c          	         sf   t |t|ddd}t jtj|||||d |   || _|| _W d    d S 1 s,w   Y  d S r]   )	r   r   r%   r&   r   r=   rM   rZ   r[   )	r)   r   r   r   r   r\   rZ   r[   r"   r*   r,   r-   r&     s   
	"zInputMediaPhoto.__init__)r4   r5   r6   r7   r8   r   r   r   r   r   r9   r   r   r   rU   r   r&   r;   r,   r,   r*   r-   r`     s8    6



r`   c                !       s   e Zd ZdZdZdddddedddddddfdddeeef de	e
 de	e de	e d	e	e d
e	e dee
 de	ee  de	e
 de	e de	e de	e de	e de	e de	e f fddZede	eeejf  fddZ  ZS )InputMediaVideoa  Represents a video to be sent.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    Note:
        *  When using a :class:`telegram.Video` for the :attr:`media` attribute, it will take the
           width, height and duration from that video, unless otherwise specified with the optional
           arguments.
        *  :paramref:`thumbnail` will be ignored for small video files, for which Telegram can
            easily generate thumbnails. However, this behaviour is undocumented and might be
            changed by Telegram.

    .. versionchanged:: 20.5
      |removed_thumb_note|

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` |             :class:`pathlib.Path` | :class:`telegram.Video`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.Video` object to send.

            .. versionchanged:: 13.2
               Accept :obj:`bytes` as input.
        filename (:obj:`str`, optional): Custom file name for the video, when uploading a
            new file. Convenience parameter, useful e.g. when sending files generated by the
            :obj:`tempfile` module.

            .. versionadded:: 13.1
        caption (:obj:`str`, optional): Caption of the video to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
            entities parsing.
        parse_mode (:obj:`str`, optional): |parse_mode|
        caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|

            .. versionchanged:: 20.0
                |sequenceclassargs|

        width (:obj:`int`, optional): Video width.
        height (:obj:`int`, optional): Video height.
        duration (:obj:`int` | :class:`datetime.timedelta`, optional): Video duration in seconds.

            .. versionchanged:: v22.2
                |time-period-input|
        supports_streaming (:obj:`bool`, optional): Pass :obj:`True`, if the uploaded video is
            suitable for streaming.
        has_spoiler (:obj:`bool`, optional): Pass :obj:`True`, if the video needs to be covered
            with a spoiler animation.

            .. versionadded:: 20.0
        thumbnail (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): |thumbdocstringnopath|

            .. versionadded:: 20.2
        cover (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): Cover for the video in the message. |fileinputnopath|

            .. versionchanged:: 21.11
        start_timestamp (:obj:`int`, optional): Start timestamp for the video in the message

            .. versionchanged:: 21.11
        show_caption_above_media (:obj:`bool`, optional): Pass |show_cap_above_med|

            .. versionadded:: 21.3

    Attributes:
        type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.VIDEO`.
        media (:obj:`str` | :class:`telegram.InputFile`): Video file to send.
        caption (:obj:`str`): Optional. Caption of the video to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
            after entities parsing.
        parse_mode (:obj:`str`): Optional. |parse_mode|
        caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|

            .. versionchanged:: 20.0

                * |tupleclassattrs|
                * |alwaystuple|
        width (:obj:`int`): Optional. Video width.
        height (:obj:`int`): Optional. Video height.
        duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Video duration in seconds.

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        supports_streaming (:obj:`bool`): Optional. :obj:`True`, if the uploaded video is
            suitable for streaming.
        has_spoiler (:obj:`bool`): Optional. :obj:`True`, if the video is covered with a
            spoiler animation.

            .. versionadded:: 20.0
        thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|

            .. versionadded:: 20.2
        show_caption_above_media (:obj:`bool`): Optional. |show_cap_above_med|

            .. versionadded:: 21.3
        cover (:class:`telegram.InputFile`): Optional. Cover for the video in the message.
            |fileinputnopath|

            .. versionchanged:: 21.11
        start_timestamp (:obj:`int`): Optional. Start timestamp for the video in the message

            .. versionchanged:: 21.11
    )	rD   rE   rZ   rF   r[   rG   rH   r.   rI   Nr!   r   r   rI   rF   rJ   rH   r   r   r\   rZ   r.   r[   rE   rG   r"   c                   s   t |tr$|d ur|n|j}|d ur|n|j}|d ur|n|j}|j}nt||	ddd}t jt	j
|||||d |  2 || _|| _t|| _| || _|| _|
| _|| _|rat|dddnd | _|| _W d    d S 1 srw   Y  d S )NTr^   r!   r0   )rK   r   rI   rF   rD   rL   r   r%   r&   r   r>   rM   r   r3   r.   rH   rZ   r[   rE   rG   )r)   r   r   rI   rF   rJ   rH   r   r   r\   rZ   r.   r[   rE   rG   r"   r*   r,   r-   r&     s8   


"zInputMediaVideo.__init__r/   c                 C   rN   rO   rQ   rR   r,   r,   r-   rJ     rS   zInputMediaVideo.duration)r4   r5   r6   r7   r8   r   r   r   r   r   r9   rT   r   rU   r   r   r   r   r&   rV   rW   rX   rJ   r;   r,   r,   r*   r-   ra     sf    g

	
4&ra   c                       s   e Zd ZdZdZdeddddddfdddeeef de	e
 dee
 de	e d	e	e
 d
e	e
 de	ee  de	e
 de	e de	e f fddZede	eeejf  fddZ  ZS )InputMediaAudioa  Represents an audio file to be treated as music to be sent.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    Note:
        When using a :class:`telegram.Audio` for the :attr:`media` attribute, it will take the
        duration, performer and title from that video, unless otherwise specified with the
        optional arguments.

    .. versionchanged:: 20.5
      |removed_thumb_note|

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes` |             :class:`pathlib.Path` | :class:`telegram.Audio`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.Audio` object to send.

            .. versionchanged:: 13.2
               Accept :obj:`bytes` as input.
        filename (:obj:`str`, optional): Custom file name for the audio, when uploading a
            new file. Convenience parameter, useful e.g. when sending files generated by the
            :obj:`tempfile` module.

            .. versionadded:: 13.1
        caption (:obj:`str`, optional): Caption of the audio to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
            entities parsing.
        parse_mode (:obj:`str`, optional): |parse_mode|
        caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|

            .. versionchanged:: 20.0
                |sequenceclassargs|

        duration (:obj:`int` | :class:`datetime.timedelta`, optional): Duration of the audio
            in seconds as defined by the sender.

            .. versionchanged:: v22.2
                |time-period-input|
        performer (:obj:`str`, optional): Performer of the audio as defined by the sender or by
            audio tags.
        title (:obj:`str`, optional): Title of the audio as defined by the sender or by audio tags.
        thumbnail (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): |thumbdocstringnopath|

            .. versionadded:: 20.2

    Attributes:
        type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.AUDIO`.
        media (:obj:`str` | :class:`telegram.InputFile`): Audio file to send.
        caption (:obj:`str`): Optional. Caption of the audio to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
            after entities parsing.
        parse_mode (:obj:`str`): Optional. |parse_mode|
        caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|

            .. versionchanged:: 20.0

                * |tupleclassattrs|
                * |alwaystuple|
        duration (:obj:`int` | :class:`datetime.timedelta`): Optional. Duration of the audio
            in seconds.

            .. deprecated:: v22.2
                |time-period-int-deprecated|
        performer (:obj:`str`): Optional. Performer of the audio as defined by the sender or by
            audio tags.
        title (:obj:`str`): Optional. Title of the audio as defined by the sender or by audio tags.
        thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|

            .. versionadded:: 20.2

    )rD   	performerr.   titleNr!   r   r   r   rJ   rc   rd   r   r\   r.   r"   c
                   s   t |tr$|d ur|n|j}|d u r|jn|}|d u r|jn|}|j}nt||ddd}t jt	j
|||||
d |   | |	| _t|| _|| _|| _W d    d S 1 sZw   Y  d S r]   )rK   r   rD   rc   rd   rL   r   r%   r&   r   AUDIOrM   r3   r.   r   )r)   r   r   r   rJ   rc   rd   r   r\   r.   r"   r*   r,   r-   r&     s,   


"zInputMediaAudio.__init__r/   c                 C   rN   rO   rQ   rR   r,   r,   r-   rJ   6  rS   zInputMediaAudio.duration)r4   r5   r6   r7   r8   r   r   r   r   r   r9   r   r   r   r   r   r&   rV   rT   rW   rX   rJ   r;   r,   r,   r*   r-   rb     sH    I

	
(&rb   c                       s   e Zd ZdZdZdeddddfdddeeef de	e
 dee
 de	e d	e	ee  d
e	e
 de	e de	e f fddZ  ZS )InputMediaDocumentaq
  Represents a general file to be sent.

    .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`

    .. versionchanged:: 20.5
      |removed_thumb_note|

    Args:
        media (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | :obj:`bytes`             | :class:`pathlib.Path` | :class:`telegram.Document`): File to send. |fileinputnopath|
            Lastly you can pass an existing :class:`telegram.Document` object to send.

            .. versionchanged:: 13.2
               Accept :obj:`bytes` as input.
        filename (:obj:`str`, optional): Custom file name for the document, when uploading a
            new file. Convenience parameter, useful e.g. when sending files generated by the
            :obj:`tempfile` module.

            .. versionadded:: 13.1
        caption (:obj:`str`, optional): Caption of the document to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
            entities parsing.
        parse_mode (:obj:`str`, optional): |parse_mode|
        caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): |caption_entities|

            .. versionchanged:: 20.0
                |sequenceclassargs|

        disable_content_type_detection (:obj:`bool`, optional): Disables automatic server-side
            content type detection for files uploaded using multipart/form-data. Always
            :obj:`True`, if the document is sent as part of an album.
        thumbnail (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`,                 optional): |thumbdocstringnopath|

            .. versionadded:: 20.2

    Attributes:
        type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.DOCUMENT`.
        media (:obj:`str` | :class:`telegram.InputFile`): File to send.
        caption (:obj:`str`): Optional. Caption of the document to be sent,
            0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
            after entities parsing.
        parse_mode (:obj:`str`): Optional. |parse_mode|
        caption_entities (tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|

            .. versionchanged:: 20.0

                * |tupleclassattrs|
                * |alwaystuple|
        disable_content_type_detection (:obj:`bool`): Optional. Disables automatic server-side
            content type detection for files uploaded using multipart/form-data. Always
            :obj:`True`, if the document is sent as part of an album.
        thumbnail (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|

            .. versionadded:: 20.2
    )disable_content_type_detectionr.   Nr!   r   r   r   rg   r   r\   r.   r"   c          	         sl   t |t|ddd}t jtj|||||d |   | || _|| _	W d    d S 1 s/w   Y  d S r]   )
r   r	   r%   r&   r   DOCUMENTrM   r3   r.   rg   )	r)   r   r   r   rg   r   r\   r.   r"   r*   r,   r-   r&   w  s   
"zInputMediaDocument.__init__)r4   r5   r6   r7   r8   r   r   r   r	   r   r9   r   rU   r   r   r   r&   r;   r,   r,   r*   r-   rf   ;  s8    9



rf   )7r7   datetimerW   collections.abcr   typingr   r   r   telegramr   telegram._files.animationr   telegram._files.audior   telegram._files.documentr	   telegram._files.inputfiler
   telegram._files.photosizer   telegram._files.videor   telegram._messageentityr   telegram._telegramobjectr   telegram._utilsr   telegram._utils.argumentparsingr   r   telegram._utils.datetimer   telegram._utils.defaultvaluer   telegram._utils.filesr   telegram._utils.typesr   r   r   r   telegram.constantsr   	MediaTyper   r<   rA   rC   rY   r`   ra   rb   rf   r,   r,   r,   r-   <module>   s@   H*p Y .y