From 854caa1fc1196f97846c666739d03de4e125903f Mon Sep 17 00:00:00 2001 From: shriMADhav U k Date: Fri, 3 Jan 2025 18:18:20 +0100 Subject: [PATCH] Added the parameter pay_for_upgrade to the method send_gift. --- docs/source/releases/changes-in-this-fork.rst | 1 + pyrogram/methods/business/send_gift.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/docs/source/releases/changes-in-this-fork.rst b/docs/source/releases/changes-in-this-fork.rst index 14689ead8..d5a404250 100644 --- a/docs/source/releases/changes-in-this-fork.rst +++ b/docs/source/releases/changes-in-this-fork.rst @@ -25,6 +25,7 @@ Changes in this Fork | Scheme layer used: 196 | +------------------------+ +- Added the ``pay_for_upgrade`` in the :meth:`~pyrogram.Client.send_gift`. - Added the parameters ``upgrade_star_count`` and ``is_for_birthday`` in :obj:`~pyrogram.types.Gift`. - Added the :meth:`~pyrogram.Client.on_bot_purchased_paid_media` and :meth:`~pyrogram.Client.on_bot_business_connection`. - Added the parameters ``can_be_upgraded``, ``was_refunded``, ``prepaid_upgrade_star_count``, ``can_be_transferred``, ``transfer_star_count``, ``export_date`` in :obj:`~pyrogram.types.UserGift`. diff --git a/pyrogram/methods/business/send_gift.py b/pyrogram/methods/business/send_gift.py index 489c74cfa..824fffe1b 100644 --- a/pyrogram/methods/business/send_gift.py +++ b/pyrogram/methods/business/send_gift.py @@ -28,6 +28,7 @@ async def send_gift( self: "pyrogram.Client", user_id: Union[int, str], gift_id: int, + pay_for_upgrade: Optional[bool] = None, text: Optional[str] = None, parse_mode: Optional["enums.ParseMode"] = None, entities: Optional[list["types.MessageEntity"]] = None, @@ -46,6 +47,9 @@ async def send_gift( gift_id (``int``): Identifier of the gift. + pay_for_upgrade (``bool``, *optional*): + Pass True to pay for the gift upgrade from the sender's balance, thereby making the upgrade free for the receiver. + text (``str``, *optional*): Text that will be shown along with the gift. 0-``gift_text_length_max`` characters. @@ -84,6 +88,7 @@ async def send_gift( user_id=peer, gift_id=gift_id, hide_name=is_private, + include_upgrade=pay_for_upgrade, message=raw.types.TextWithEntities( text=text, entities=entities or [] ) if text else None