o
    -˜ŽjÑ  ã                   @   s>   d dl Z d dlmZmZ d dlZd dlmZ G dd„ dƒZdS )é    N)ÚListÚUnion)Úrawc                   @   s2   e Zd Zdddeeef dee defdd„ZdS )	ÚSetPinnedGiftsÚselfzpyrogram.ClientÚowner_idÚowned_gift_idsÚreturnc              	   Ã   sì   �g }|D ]Y}t |tƒstdt|ƒ› d�ƒ‚t dt|ƒ¡}| j t|ƒ¡}|rB| tj	j
|  | d¡¡I dH t| d¡ƒd�¡ q|rR| tj	j| d¡d�¡ q| tj	jt|ƒd	�¡ q|  tjjj|  |¡I dH |d
�¡I dH }|S )a]  Change the list of pinned gifts on the current user.

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

        Parameters:
            owner_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).

            owned_gift_ids (List of ``str``):
                New list of pinned gifts.
                All gifts must be upgraded and saved on the profile page first.
                For a user gift, you can use the message ID (int) of the gift message.
                For a channel gift, you can use the packed format `chatID_savedID` (str).
                For a upgraded gift, you can use the gift link.

        Returns:
            ``bool``: On success, True is returned.

        Example:
            .. code-block:: python

                # Set pinned gifts in user profile
                await app.set_pinned_gifts(received_gift_ids=["123", "456"])
        zgift id has to be str, but z was providedz^(\d+)_(\d+)$é   Né   )ÚpeerÚsaved_id)Úslug)Úmsg_id)r   Ústargift)Ú
isinstanceÚstrÚ
ValueErrorÚtypeÚreÚmatchÚUPGRADED_GIFT_REÚappendr   ÚtypesÚInputSavedStarGiftChatÚresolve_peerÚgroupÚintÚInputSavedStarGiftSlugÚInputSavedStarGiftUserÚinvokeÚ	functionsÚpaymentsÚToggleStarGiftsPinnedToTop)r   r   r   Ú	stargiftsÚgiftÚsaved_gift_matchÚ
slug_matchÚr© r)   úg/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/payments/set_pinned_gifts.pyÚset_pinned_gifts   s@   €
þÿÿÿÿÿþ
ÿzSetPinnedGifts.set_pinned_giftsN)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   Úboolr+   r)   r)   r)   r*   r      s    ÿ
þýür   )r   Útypingr   r   Úpyrogramr   r   r)   r)   r)   r*   Ú<module>   s
   