o
    -˜Žj”  ã                   @   s:   d dl mZmZ d dlZd dlmZmZ G dd„ dƒZdS )é    )ÚOptionalÚUnionN)ÚrawÚtypesc                   @   sp   e Zd Z								ddddeeef dee dee d	ee d
ee dee dee dedefdd„ZdS )ÚGetChatGiftsNr   Ú Úselfzpyrogram.ClientÚchat_idÚexclude_unsavedÚexclude_savedÚexclude_unlimitedÚexclude_limitedÚexclude_upgradedÚsort_by_valueÚlimitÚoffsetc
                   sÚ   �ˆ  |¡I dH }
d}t|ƒpd}td|ƒ}	 ˆjtjjj|
|	|||||||d�	dd�I dH }d	d
„ |jD ƒ‰dd
„ |j	D ƒ‰ ‡ ‡‡fdd„|j
D ƒI dH }|sRdS |D ]}|V  |d7 }||krd dS qT|j}	|	sldS q)a  Get all gifts owned by specified chat.

        .. include:: /_includes/usable-by/users.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).
            
            exclude_unsaved (``bool``, *optional*):
                Exclude unsaved star gifts.
                
            exclude_saved (``bool``, *optional*):
                Exclude saved star gifts.
                
            exclude_unlimited (``bool``, *optional*):
                Exclude unlimited star gifts.
                
            exclude_limited (``bool``, *optional*):
                Exclude limited star gifts.
                
            exclude_upgraded (``bool``, *optional*):
                Exclude upgraded star gifts.
                
            sort_by_value (``bool``, *optional*):
                Sort star gifts by value.

            offset (``str``, *optional*):
                Offset of the results to be returned.

            limit (``int``, *optional*):
                Maximum amount of star gifts to be returned.

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

        Example:
            .. code-block:: python

                async for gift in app.get_chat_gifts(chat_id):
                    print(gift)
        Nr   iÿÿÿéd   T)	Úpeerr   r   r
   r   r   r   Úexclude_uniquer   é<   )Úsleep_thresholdc                 S   ó   i | ]}|j |“qS © ©Úid©Ú.0Úir   r   úe/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/payments/get_chat_gifts.pyÚ
<dictcomp>g   ó    z/GetChatGifts.get_chat_gifts.<locals>.<dictcomp>c                 S   r   r   r   r   r   r   r   r   h   r    c                 “   s&   �g | ]}t j ˆ|ˆˆ ¡I d H ‘qS )N)r   ÚGiftÚ_parse_saved)r   Úgift©Úchatsr   Úusersr   r   Ú
<listcomp>j   s
   € ÿÿz/GetChatGifts.get_chat_gifts.<locals>.<listcomp>é   )Úresolve_peerÚabsÚminÚinvoker   Ú	functionsÚpaymentsÚGetSavedStarGiftsr&   r%   ÚgiftsÚnext_offset)r   r	   r
   r   r   r   r   r   r   r   r   ÚcurrentÚtotalÚrÚuser_star_giftsr#   r   r$   r   Úget_chat_gifts   sJ   €7
÷ôþÿÚzGetChatGifts.get_chat_gifts)NNNNNNr   r   )	Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrr   Úboolr6   r   r   r   r   r      s<    öÿ
þýüûúùø	÷
ör   )Útypingr   r   Úpyrogramr   r   r   r   r   r   r   Ú<module>   s   