
    i                     D    S SK JrJr  S SKrS SKJrJrJr   " S S5      rg)    )AsyncGeneratorOptionalN)rawtypesutilsc                   N    \ rS rSr   SSSS\S\\   S\\   S\S	   4
S
 jjrSr	g)
GetDialogs   Nselfzpyrogram.Clientlimitexclude_pinnedfrom_archivereturn)ztypes.DialogNc                  ^#    SnU=(       d    Sn[        SU5      nSnSn[        R                  R                  5       n[	        5       n	 U R                  [        R                  R                  R                  UUUUSUUc  SO
U(       a  SOSS9SS9I Sh  vN n
U
R                   Vs0 s H  oR                  U_M     nnU
R                   Vs0 s H  oR                  U_M     nn0 mU
R                   Hw  n[        U[        R                  R                  5      (       a  M.  [        R                  R                  XX5      I Sh  vN T[         R"                  " UR$                  5      '   My     / nU
R&                   GH  n[        U[        R                  R(                  5      (       d  M/  [         R*                  " UR,                  5      nUU	;   a  MW  [        UR/                  U5      =(       d    UR/                  U5      [        R                  R0                  [        R                  R2                  45      (       a  M  U	R5                  U5        UR7                  [        R(                  R                  U UTX5      5        GM     U(       d  g[9        [;        SU4S	 j[=        U5       5       5      S5      nU(       a  UR                  OSnU(       a   [         R>                  " UR@                  5      OSnU RC                  US
   RD                  R                  5      I Sh  vN nU H  nU7v   US-  nXE:  d  M    g   GM   GNs  snf s  snf  GN N17f)aa  Get a user's dialogs sequentially.

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

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

    exclude_pinned (``bool``, *optional*):
        Exclude pinned dialogs.

    from_archive (``bool``, *optional*):
        Pass True to get dialogs from archive.

Returns:
    ``Generator``: A generator yielding :obj:`~pyrogram.types.Dialog` objects.

Example:
    .. code-block:: python

        # Iterate through all dialogs
        async for dialog in app.get_dialogs():
            print(dialog.chat.first_name or dialog.chat.title)

        # Iterate through dialogs from archive
        async for dialog in app.get_dialogs(from_archive=True):
            print(dialog.chat.first_name or dialog.chat.title)
r   id   N   )offset_date	offset_idoffset_peerr   hashr   	folder_id<   )sleep_thresholdc              3   n   >#    U  H*  nTR                  UR                  R                  5      v   M,     g 7f)N)getchatid).0dmessagess     O/app/mltbenv/lib/python3.13/site-packages/pyrogram/methods/chats/get_dialogs.py	<genexpr>)GetDialogs.get_dialogs.<locals>.<genexpr>x   s'     Q?P!hll1669955?Ps   25)#minr   r   InputPeerEmptysetinvoke	functionsr    r	   usersr   chats
isinstanceMessageEmptyMessage_parser   get_peer_idpeer_iddialogsDialogget_raw_peer_idpeerr   	UserEmpty	ChatEmptyaddappendnextfilterreverseddatetime_to_timestampdateresolve_peerr   )r   r   r   r   currenttotalr   r   r   seen_dialogs_idsrir*   r+   messager2   dialogr1   last_messager    s                      @r!   get_dialogsGetDialogs.get_dialogs   s    F &C	ii..05kk&&11 +' +#1&2&:d\WX 2  !# "  A '(gg.gTT1WgE.&'gg.gTT1WgE.H::gsyy'='=>>EJ]]EYEY5F @**7??;<	 & G))!&#))*:*:;;//<..eii0FEIIg4FI\I\^a^g^g^q^qHrss $$W-u||2245XY $  tQx?PQRTXL ,8QILX%55l6G6GH^_K $ 1 1'"+2B2B2E2E FFK!1# "q  /.@> GsV   BMMM)M?MM%A!MMGM"M#M=MMM )r   NN)
__name__
__module____qualname____firstlineno__intr   boolr   rH   __static_attributes__rJ       r!   r	   r	      sZ     )-'+	kkk !k tn	k
 
,	-k krR   r	   )typingr   r   pyrogramr   r   r   r	   rJ   rR   r!   <module>rU      s   & ,  & &l lrR   