U
    ;g                     @   sV   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 G dd dZ	dS )    )datetime)UnionListIterableN)rawutils)typesc                   @   sR   e Zd Zddeeef eeef eeee f eeeede	d f dddZ
dS )ForwardMessagesNzpyrogram.Clientztypes.Message)selfchat_idfrom_chat_idmessage_idsdisable_notificationschedule_dateprotect_contentreturnc                    s   t |t }|rt|n|g} tjjj |I dH  |I dH ||pNd fdd|D t	
||dI dH }g }	dd |jD }
dd |jD }|jD ]@}t |tjjtjjtjjfr|	tj |j|
|I dH  q|rt|	S |	d S )	a  Forward messages of any kind.

        .. 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).

            from_chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the source chat where the original message was sent.
                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).

            message_ids (``int`` | Iterable of ``int``):
                An iterable of message identifiers in the chat specified in *from_chat_id* or a single message id.

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

            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.

        Returns:
            :obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
            a list, a single message is returned, otherwise a list of messages is returned.

        Example:
            .. code-block:: python

                # Forward a single message
                await app.forward_messages(to_chat, from_chat, 123)

                # Forward multiple messages at once
                await app.forward_messages(to_chat, from_chat, [1, 2, 3])
        Nc                    s   g | ]}   qS  )Zrnd_id).0_r
   r   j/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/messages/forward_messages.py
<listcomp>X   s     z4ForwardMessages.forward_messages.<locals>.<listcomp>)Zto_peerZ	from_peeridZsilentZ	random_idr   Z
noforwardsc                 S   s   i | ]}|j |qS r   r   r   ir   r   r   
<dictcomp>`   s      z4ForwardMessages.forward_messages.<locals>.<dictcomp>c                 S   s   i | ]}|j |qS r   r   r   r   r   r   r   a   s      r   )
isinstanceintlistZinvoker   Z	functionsmessagesr	   Zresolve_peerr   Zdatetime_to_timestampuserschatsZupdatesr   ZUpdateNewMessageZUpdateNewChannelMessageZUpdateNewScheduledMessageappendMessage_parsemessager   )r
   r   r   r   r   r   r   Zis_iterablerZforwarded_messagesr!   r"   r   r   r   r   forward_messages   s<    3


  z ForwardMessages.forward_messages)NNN)__name__
__module____qualname__r   r   strr   boolr   r   r(   r   r   r   r   r	      s      

r	   )
r   typingr   r   r   Zpyrogramr   r   r   r	   r   r   r   r   <module>   s
   