Skip to content

Commit 7c6d903

Browse files
committed
Update Types, according to TDLib
1 parent a768a54 commit 7c6d903

17 files changed

+69
-48
lines changed

docs/source/releases/changes-in-this-fork.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ Breaking Changes
1919
Changes in this Fork
2020
=====================
2121

22+
+------------------------+
23+
| Scheme layer used: 194 |
24+
+------------------------+
25+
26+
- Added the field ``subscription_expiration_date`` in the :obj:`~pyrogram.types.SuccessfulPayment`.
27+
- Added the parameter ``subscription_period`` in the :meth:`~pyrogram.Client.create_invoice_link`.
28+
- View `new and changed <https://telegramplayground.github.io/TG-APIs/TL/diff/tdlib.html?from=192&to=194>`__ `raw API methods <https://telegramplayground.github.io/TG-APIs/TL/diff/tdesktop.html?from=192&to=194>`__.
29+
2230
+------------------------+
2331
| Scheme layer used: 192 |
2432
+------------------------+

pyrogram/methods/business/create_invoice_link.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

1919
import logging
20+
from datetime import datetime
2021
from typing import List, Optional, Union
2122

2223
import pyrogram
@@ -34,6 +35,7 @@ async def create_invoice_link(
3435
currency: str,
3536
prices: List["types.LabeledPrice"],
3637
provider_token: str = None,
38+
subscription_period: datetime = None,
3739
max_tip_amount: int = None,
3840
suggested_tip_amounts: List[int] = None,
3941
start_parameter: str = None,
@@ -73,6 +75,9 @@ async def create_invoice_link(
7375
provider_token (``str``, *optional*):
7476
Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
7577
78+
subscription_period (:py:obj:`~datetime.datetime`, *optional*):
79+
The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.
80+
7681
max_tip_amount (``int``, *optional*):
7782
The maximum accepted amount for tips in the smallest units of the currency (integer, **not** float/double). For example, for a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the exp parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
7883
@@ -148,7 +153,8 @@ async def create_invoice_link(
148153
shipping_address_requested=need_shipping_address,
149154
flexible=is_flexible,
150155
phone_to_provider=send_phone_number_to_provider,
151-
email_to_provider=send_email_to_provider
156+
email_to_provider=send_email_to_provider,
157+
subscription_period=utils.datetime_to_timestamp(subscription_period)
152158
),
153159
payload=payload.encode() if isinstance(payload, str) else payload,
154160
provider=provider_token,

pyrogram/methods/business/get_available_gifts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def get_available_gifts(
2727
) -> List["types.Gift"]:
2828
"""Get all gifts that can be sent to other users.
2929
30-
.. include:: /_includes/usable-by/users.rst
30+
.. include:: /_includes/usable-by/users-bots.rst
3131
3232
Returns:
3333
List of :obj:`~pyrogram.types.Gift`: On success, a list of star gifts is returned.

pyrogram/methods/business/get_business_connection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from datetime import datetime
2019
from typing import Union, List
2120

2221
import pyrogram

pyrogram/methods/business/send_gift.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ async def send_gift(
4444
For a contact that exists in your Telegram address book you can use his phone number (str).
4545
4646
gift_id (``int``):
47-
Unique identifier of the gift to send.
47+
Identifier of the gift.
4848
4949
text (``str``, *optional*):
50-
Text of the message to be sent. 0-``gift_text_length_max`` characters.
50+
Text that will be shown along with the gift. 0-``gift_text_length_max`` characters.
5151
5252
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
5353
By default, texts are parsed using both Markdown and HTML styles.
@@ -58,7 +58,7 @@ async def send_gift(
5858
Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed.
5959
6060
is_private (``bool``, *optional*):
61-
Pass True to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them.
61+
For users only: Pass True to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them.
6262
6363
Returns:
6464
``bool``: On success, True is returned.

pyrogram/methods/business/send_invoice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def send_invoice(
9191
Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
9292
9393
message_thread_id (``int``, *optional*):
94-
If the message is in a thread, ID of the original message.
94+
Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.
9595
9696
provider_token (``str``, *optional*):
9797
Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.

pyrogram/methods/chat_topics/close_forum_topic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from datetime import datetime
20-
from typing import Union, List
19+
from typing import Union
2120

2221
import pyrogram
2322
from pyrogram import types, utils, raw

pyrogram/methods/chat_topics/create_forum_topic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from datetime import datetime
20-
from typing import Union, List
19+
from typing import Union
2120

2221
import pyrogram
2322
from pyrogram import types, utils, raw

pyrogram/methods/chat_topics/delete_forum_topic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from datetime import datetime
20-
from typing import Union, List
19+
from typing import Union
2120

2221
import pyrogram
2322
from pyrogram import types, utils, raw

pyrogram/methods/chat_topics/edit_forum_topic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from datetime import datetime
20-
from typing import Union, List
19+
from typing import Union
2120

2221
import pyrogram
2322
from pyrogram import types, utils, raw

0 commit comments

Comments
 (0)