
    i                     D    S SK Jr  S SKrS SKJrJrJrJr   " S S5      rg)    )OptionalN)errorsrawtypesutilsc                   L    \ rS rSr   SSSS\S\\   S\S\S	\S
   4S jjrSr	g)UpgradeGift   Nselfzpyrogram.Clientowned_gift_idkeep_original_details
star_countbusiness_connection_idreturnztypes.Messagec                   #    [         R                  " X5      I Sh  vN n U R                  [        R                  R
                  R                  UUS9US9I Sh  vN n[         R$                  " U ['        U[        R                  R
                  R(                  5      (       a  UR*                  OUS	9I Sh  vN n	U	(       a  U	S   $ S$  N Np! [        R                   a    [        R                  R                  UUS9nU R                  [        R                  R
                  R                  US9US9I Sh  vN  nUbC  US:  a  [        S5      eUR                  R                  S   R                  U:  a  [        S5      eU R                  [        R                  R
                  R!                  UR"                  US9US9I Sh  vN  n GNpf = f GN7f)
a;  Upgrade a given regular gift to a unique gift.

.. note::

    Requires the `can_transfer_and_upgrade_gifts` business bot right.
    Additionally requires the `can_transfer_stars` business bot right if the upgrade is paid.

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

Parameters:
    owned_gift_id (``str``):
        Unique identifier of the regular gift that should be upgraded to a unique one.
        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.

    keep_original_details (``bool``, *optional*):
        Pass True to keep the original gift text, sender and receiver in the upgraded gift.

    star_count (``int``, *optional*):
        The amount of Telegram Stars required to pay for the upgrade.

    business_connection_id (``str``, *optional*):
        Unique identifier of the business connection.
        For bots only.

Returns:
    :obj:`~pyrogram.types.Message`: On success, the sent message is returned.

Example:
    .. code-block:: python

        # Upgrade gift
        await app.upgrade_gift(owned_gift_id="123")

        # Upgrade gift in channel (owned_gift_id packed in format chatID_savedID)
        await app.upgrade_gift(owned_gift_id="123_456")
N)stargiftr   )r   )invoicer   z+Invalid amount of Telegram Stars specified.zHave not enough Telegram Stars.)form_idr   )clientmessages)r   get_input_stargiftinvoker   	functionspaymentsUpgradeStarGiftr   PaymentRequiredr   InputInvoiceStarGiftUpgradeGetPaymentForm
ValueErrorr   pricesamountSendStarsFormr   parse_messages
isinstancePaymentResultupdates)
r   r   r   r   r   r   rr   formr   s
             S/app/mltbenv/lib/python3.13/site-packages/pyrogram/methods/payments/upgrade_gift.pyupgrade_giftUpgradeGift.upgrade_gift   s    Z 11$FF"	kk&&66%*? 7  (> "  AF --",Q		0B0B0P0P"Q"QQYYWX
 

 'x{0D0W G %% 	ii;;!&; < G
 &&55# 6  (>	 %   D %>$%RSS<<&&q)00:=$%FGGkk&&44 LL# 5  (> "   A)	8
sk   GC
G9C CC  AG7G8GC A*G8D;9BGG
GGGG )NNN)
__name__
__module____qualname____firstlineno__strr   boolintr*   __static_attributes__r,       r)   r	   r	      s`     15&*X1X1X1  (~X1 	X1
 !$X1 
/	"X1 X1r5   r	   )typingr   pyrogramr   r   r   r   r	   r,   r5   r)   <module>r8      s   &   . .Y1 Y1r5   