
    N[iE                     H    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      Zy)    )UnionAsyncGeneratorOptionalN)typesrawutilsc                   >    e Zd Z	 d	dddeeef   dedeed      fdZy)
GetChatPhotosselfzpyrogram.Clientchat_idlimitreturn)ztypes.PhotoNc                  K   | j                  |       d{   }t        |t        j                  j                        rd| j                  t        j                  j                  j                  |             d{   }t        j                  j                  | |j                  j                        xs g }t        j                  | | j                  t        j                  j                  j!                  |dt        j                  j#                         dddd|ddd             d{          d{   }|D cg c]  }|j$                   }}|r*|r%|j&                  |d   j&                  k7  r|g|z   n|}n|}n|r|g}ng }d}|D ]  }	|	 |dz  }||k\  s y yd}|xs d}
t)        d|
      }d}	 | j                  t        j                  j*                  j-                  ||d|	             d{   }|j*                  D 	cg c]"  }	t        j                  j                  | |	      $ }}	|sy|t/        |      z  }|D ]  }	|	 |dz  }||
k\  s y 7 J7 7 ;7 2c c}w 7 vc c}	w w)
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).

            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` 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hash   l        d   )user_idoffsetr   r   )resolve_peer
isinstancer   r   InputPeerChannelinvoke	functionschannelsGetFullChannelPhoto_parse	full_chat
chat_photor   parse_messagesmessagesSearchInputMessagesFilterChatPhotosnew_chat_photofile_idminphotosGetUserPhotoslen)r   r   r   peer_idrcurrentmessageextrar2   photototalr   s               Y/var/www/files/kim/lib/python3.12/site-packages/pyrogram/methods/users/get_chat_photos.pyget_chat_photoszGetChatPhotos.get_chat_photos   sx    8 ))'22gsyy99:kk&&55# 6  A kk((q{{/E/EFL"G**kkMM**11$"yyFFH!"!""##$#   2   A& <==W++=E=4;OOuQxGWGW4Wwi%/]bF"F%YFFG 1e# G&gEUOEF++MM((66 '% #	 7   HIxxPe%++,,T59PP#f+%# EKqLG%'# u 3& >: Qs   I9I!A%I9=I$>B.I9,I'
-I98I*9I9I-AI9!AI9;I2<I9'I45'I9I9$I9'I9*I9-I94I9N)r   )	__name__
__module____qualname__r   intstrr   r   r=        r<   r
   r
      sH     mmsCxm m 
.!45	6	mrD   r
   )	typingr   r   r   pyrogramr   r   r   r
   rC   rD   r<   <module>rG      s"   & 3 2  & &n nrD   