U
    ;gg                     @   sb   d dl m Z  d dlmZmZmZ d dlZd dlmZmZ d dlmZ d dlm	Z	 G dd dZ
dS )	    )datetime)UnionListOptionalN)rawenums)types)utilsc                   @   sJ   e Zd Zddeeef eeed ed eee	eed ed dd	d
Z
dS )SendCachedMedia Nzpyrogram.Clientzenums.ParseModeztypes.MessageEntity)ztypes.InlineKeyboardMarkupztypes.ReplyKeyboardMarkupztypes.ReplyKeyboardRemoveztypes.ForceReplyztypes.Message)selfchat_idfile_idcaption
parse_modecaption_entitiesdisable_notificationreply_to_message_idschedule_dateprotect_contentreply_markupreturnc                    s   |  tjjjf | |I dH t||p*d||  t	||	|
rP|

| I dH nddt| |||I dH I dH }|jD ]d}t|tjjtjjtjjfr~tjj| |jdd |jD dd |jD t|tjjdI dH   S q~dS )a*
  Send any media stored on the Telegram servers using a file_id.

        This convenience method works with any valid file_id only.
        It does the same as calling the relevant method for sending media using a file_id, thus saving you from the
        hassle of using the correct method for the media the file_id is pointing to.

        .. include:: /_includes/usable-by/users-bots.rst

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                For your personal cloud (Saved Messages) you can simply use "me" or "self".
                For a contact that exists in your Telegram address book you can use his phone number (str).

            file_id (``str``):
                Media to send.
                Pass a file_id as string to send a media that exists on the Telegram servers.

            caption (``str``, *optional*):
                Media caption, 0-1024 characters.

            parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
                By default, texts are parsed using both Markdown and HTML styles.
                You can combine both syntaxes together.

            caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
                List of special entities that appear in the caption, which can be specified instead of *parse_mode*.

            disable_notification (``bool``, *optional*):
                Sends the message silently.
                Users will receive a notification with no sound.

            reply_to_message_id (``int``, *optional*):
                If the message is a reply, ID of the original message.

            schedule_date (:py:obj:`~datetime.datetime`, *optional*):
                Date when the message will be automatically sent.
            
            protect_content (``bool``, *optional*):
                Protects the contents of the sent message from forwarding and saving.

            reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.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:
            :obj:`~pyrogram.types.Message`: On success, the sent media message is returned.

        Example:
            .. code-block:: python

                await app.send_cached_media("me", file_id)
        N)ZpeerZmediaZsilentZreply_to_msg_idZ	random_idr   Z
noforwardsr   c                 S   s   i | ]}|j |qS  id.0ir   r   k/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/messages/send_cached_media.py
<dictcomp>y   s      z5SendCachedMedia.send_cached_media.<locals>.<dictcomp>c                 S   s   i | ]}|j |qS r   r   r   r   r   r   r   z   s      )Zis_scheduled)Zinvoker   Z	functionsmessagesZ	SendMediaZresolve_peerr	   Zget_input_media_from_file_idZrnd_idZdatetime_to_timestampwriteZparse_text_entitiesZupdates
isinstancer   ZUpdateNewMessageZUpdateNewChannelMessageZUpdateNewScheduledMessageMessage_parsemessageZusersZchats)r   r   r   r   r   r   r   r   r   r   r   rr   r   r   r   send_cached_media   s4    H
	


 z!SendCachedMedia.send_cached_media)r   NNNNNNN)__name__
__module____qualname__r   intstrr   r   boolr   r'   r   r   r   r   r
      s0           
r
   )r   typingr   r   r   Zpyrogramr   r   r   r	   r
   r   r   r   r   <module>   s   