o
    -˜Žj©  ã                   @   sB   d dl mZmZmZ d dlZd dlmZmZmZ G dd„ dƒZdS )é    )ÚUnionÚAsyncGeneratorÚOptionalN)ÚtypesÚrawÚutilsc                   @   sF   e Zd Z	ddddeeef dedeeed ed f  fd	d
„ZdS )ÚGetChatPhotosr   Úselfzpyrogram.ClientÚchat_idÚlimitÚreturn)ztypes.PhotoN)ztypes.AnimationNc                 C  sT  �|   |¡I dH }t|tjjƒrÉ|  tjjj|d�¡I dH }tj	 
| |jj¡p(g }|g}tj | |jj¡}|r<||g }g }| jjsot | |  tjjj|dtj ¡ dddd|dddd�¡I dH ¡I dH }|rmdd„ |D ƒng }|r•|r’t|ƒdkr’t|d tj	ƒr’|d j|d jkr�|| n|}n
|}n|rš|}ng }d}t|ƒdks²t|ƒdkr´t|d tj	ƒs´dS |D ]}	|	V  |d7 }||krÆ dS q¶dS d}|pÎd	}
td
|
ƒ}d}	 |  tjjj||d|d�¡I dH }g }|jD ]}	| tj	 
| |	¡¡ tj | |	¡}|�r| |¡ qí|�sdS |t|ƒ7 }|D ]}	|	V  |d7 }||
k�r' dS �qq×)a  Get a chat or a user profile photos sequentially.

        .. 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).
                You can also use user profile/chat public link in form of *t.me/<username>* (str).

            limit (``int``, *optional*):
                Limits the number of profile photos to be retrieved.
                By default, no limit is applied and all profile photos are returned.

        Returns:
            ``Generator``: A generator yielding :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Animation` objects.

        Example:
            .. code-block:: python

                async for photo in app.get_chat_photos("me"):
                    print(photo)
        N)ÚchannelÚ r   )ÚpeerÚqÚfilterÚmin_dateÚmax_dateÚ	offset_idÚ
add_offsetr   Úmax_idÚmin_idÚhashc                 S   s   g | ]}|j ‘qS © )Únew_chat_photo)Ú.0Úmessager   r   úc/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/users/get_chat_photos.pyÚ
<listcomp>c   s    z1GetChatPhotos.get_chat_photos.<locals>.<listcomp>é   l        éd   T)Úuser_idÚoffsetr   r   )Úresolve_peerÚ
isinstancer   r   ÚInputPeerChannelÚinvokeÚ	functionsÚchannelsÚGetFullChannelÚPhotoÚ_parseÚ	full_chatÚ
chat_photoÚ	AnimationÚ_parse_chat_animationÚmeÚis_botr   Úparse_messagesÚmessagesÚSearchÚInputMessagesFilterChatPhotosÚlenÚfile_idÚminÚphotosÚGetUserPhotosÚappend)r	   r
   r   Úpeer_idÚrÚcurrentÚcurrent_animationÚextrar9   ÚphotoÚtotalr"   r   r   r   Úget_chat_photos   sº   €"ÿ
ÿþ
õÿ
þÿþ"(ÿû
ü
ÿ	
ÿþ
€
ÿàzGetChatPhotos.get_chat_photosN)r   )	Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrr   r   rC   r   r   r   r   r      s"    ýÿ
þýÿÿÿür   )	Útypingr   r   r   Úpyrogramr   r   r   r   r   r   r   r   Ú<module>   s   