mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add payload parameter to send_invoice
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
32175f33c0
commit
5130e0a2e5
1 changed files with 10 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ class SendInvoice:
|
|||
prices: List["types.LabeledPrice"],
|
||||
provider: str = None,
|
||||
provider_data: str = None,
|
||||
payload: str = None,
|
||||
photo_url: str = None,
|
||||
photo_size: int = None,
|
||||
photo_mime_type: str = None,
|
||||
|
|
@ -69,6 +70,10 @@ class SendInvoice:
|
|||
provider_data (``str``, *optional*):
|
||||
Provider data in json format.
|
||||
|
||||
payload (``str``, *optional*):
|
||||
Bot-defined invoice payload, 1-128 bytes.
|
||||
This will not be displayed to the user, use for your internal processes.
|
||||
|
||||
photo_url (``str``, *optional*):
|
||||
Photo URL.
|
||||
|
||||
|
|
@ -151,6 +156,10 @@ class SendInvoice:
|
|||
quote_entities=quote_entities
|
||||
)
|
||||
|
||||
if payload is not None:
|
||||
encoded_payload = payload.encode()
|
||||
else:
|
||||
encoded_payload = f"{(title)}".encode()
|
||||
r = await self.invoke(
|
||||
raw.functions.messages.SendMedia(
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
|
|
@ -161,7 +170,7 @@ class SendInvoice:
|
|||
currency=currency,
|
||||
prices=[price.write() for price in prices]
|
||||
),
|
||||
payload=f"{(title)}".encode(),
|
||||
payload=encoded_payload,
|
||||
provider=provider,
|
||||
provider_data=raw.types.DataJSON(data=provider_data if provider_data else "{}"),
|
||||
photo=raw.types.InputWebDocument(
|
||||
|
|
|
|||
Loading…
Reference in a new issue