Skip to content

Commit 3b57c8e

Browse files
authored
Update API Scheme to Layer 200
* document about breaking change * Update API Scheme to Layer 200, from TDLib (tdlib/td@f5462e3) * Fix field documentation (tdlib/td@e4608b7) * Add the paid_message_star_count to Chat and User * bug fixes * Add paid_message_star_count to Message * Add is_pinned to UserGift
1 parent a9427b4 commit 3b57c8e

30 files changed

+264
-45
lines changed

compiler/api/source/main_api.tl

Lines changed: 30 additions & 19 deletions
Large diffs are not rendered by default.

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ Breaking Changes in this Fork
2323
- In :meth:`~pyrogram.Client.download_media`, if the message is a :obj:`~pyrogram.types.PaidMediaInfo` with more than one ``paid_media`` **and** ``idx`` was not specified, then a list of paths or binary file-like objects is returned.
2424
- PR `#115 <https://github.com/TelegramPlayGround/pyrogram/pull/115>`_ This `change <https://github.com/pyrogram/pyrogram/pull/966#issuecomment-1108858881>`_ breaks some usages with offset-naive and offset-aware datetimes.
2525
- PR from upstream: `#1411 <https://github.com/pyrogram/pyrogram/pull/1411>`_ without attribution.
26+
- If you relied on internal types like ``import pyrogram.file_id`` OR ``import pyrogram.utils``, Then read this full document to know where `else <https://t.me/PyrogramChat/42497>`_ your code will break.
2627

2728

2829
Changes in this Fork
2930
=====================
3031

32+
+------------------------+
33+
| Scheme layer used: 200 |
34+
+------------------------+
35+
36+
- Added the field ``paid_message_star_count`` to the classes :obj:`~pyrogram.types.Chat`, :obj:`~pyrogram.types.Message` and :obj:`~pyrogram.types.User`.
37+
- Added the parameter ``paid_message_star_count`` to the methods :meth:`~pyrogram.Client.copy_media_group`, :meth:`~pyrogram.Client.send_game`, :meth:`~pyrogram.Client.send_invoice`, :meth:`~pyrogram.Client.forward_messages`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_cached_media`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_media_group`, :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_paid_media`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_voice` and the bound methods :meth:`~pyrogram.types.Message.forward` and :meth:`~pyrogram.types.Message.copy`.
38+
- View `new and changed <https://telegramplayground.github.io/TG-APIs/TL/diff/tdlib.html?from=199&to=200>`__ `raw API methods <https://telegramplayground.github.io/TG-APIs/TL/diff/tdesktop.html?from=199&to=200>`__.
39+
3140
+------------------------+
3241
| Scheme layer used: 199 |
3342
+------------------------+

pyrogram/methods/bots/send_game.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ async def send_game(
3333
disable_notification: bool = None,
3434
protect_content: bool = None,
3535
allow_paid_broadcast: bool = None,
36+
paid_message_star_count: int = None,
3637
message_thread_id: int = None,
3738
business_connection_id: str = None,
3839
send_as: Union[int, str] = None,
@@ -68,6 +69,9 @@ async def send_game(
6869
6970
allow_paid_broadcast (``bool``, *optional*):
7071
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
72+
73+
paid_message_star_count (``int``, *optional*):
74+
The number of Telegram Stars the user agreed to pay to send the messages.
7175
7276
message_thread_id (``int``, *optional*):
7377
If the message is in a thread, ID of the original message.
@@ -134,6 +138,7 @@ async def send_game(
134138
send_as=await self.resolve_peer(send_as) if send_as else None,
135139
noforwards=protect_content,
136140
allow_paid_floodskip=allow_paid_broadcast,
141+
allow_paid_stars=paid_message_star_count,
137142
effect=message_effect_id,
138143
reply_markup=await reply_markup.write(self) if reply_markup else None
139144
)

pyrogram/methods/bots/send_inline_bot_result.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async def send_inline_bot_result(
3535
disable_notification: bool = None,
3636
reply_parameters: "types.ReplyParameters" = None,
3737
send_as: Union[int, str] = None,
38+
paid_message_star_count: int = None,
3839
message_thread_id: int = None,
3940
schedule_date: datetime = None,
4041
reply_to_message_id: int = None
@@ -70,6 +71,9 @@ async def send_inline_bot_result(
7071
This setting applies to the current message and will remain effective for future messages unless explicitly changed.
7172
To set this behavior permanently for all messages, use :meth:`~pyrogram.Client.set_send_as_chat`.
7273
74+
paid_message_star_count (``int``, *optional*):
75+
The number of Telegram Stars the user agreed to pay to send the messages.
76+
7377
message_thread_id (``int``, *optional*):
7478
If the message is in a thread, ID of the original message.
7579
@@ -116,6 +120,7 @@ async def send_inline_bot_result(
116120
send_as=await self.resolve_peer(send_as) if send_as else None,
117121
silent=disable_notification or None,
118122
reply_to=reply_to,
123+
allow_paid_stars=paid_message_star_count,
119124
schedule_date=utils.datetime_to_timestamp(schedule_date),
120125
)
121126
)

pyrogram/methods/business/send_invoice.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ async def send_invoice(
5454
disable_notification: bool = None,
5555
protect_content: bool = None,
5656
allow_paid_broadcast: bool = None,
57+
paid_message_star_count: int = None,
5758
message_effect_id: int = None,
5859
reply_parameters: "types.ReplyParameters" = None,
5960
send_as: Union[int, str] = None,
@@ -151,6 +152,9 @@ async def send_invoice(
151152
allow_paid_broadcast (``bool``, *optional*):
152153
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
153154
155+
paid_message_star_count (``int``, *optional*):
156+
The number of Telegram Stars the user agreed to pay to send the messages.
157+
154158
message_effect_id (``int`` ``64-bit``, *optional*):
155159
Unique identifier of the message effect to be added to the message; for private chats only.
156160
@@ -229,6 +233,7 @@ async def send_invoice(
229233
send_as=await self.resolve_peer(send_as) if send_as else None,
230234
noforwards=protect_content,
231235
allow_paid_floodskip=allow_paid_broadcast,
236+
allow_paid_stars=paid_message_star_count,
232237
reply_markup=await reply_markup.write(self) if reply_markup else None,
233238
effect=message_effect_id,
234239
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)

pyrogram/methods/messages/copy_media_group.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ async def copy_media_group(
4040
schedule_date: datetime = None,
4141
protect_content: bool = None,
4242
allow_paid_broadcast: bool = None,
43+
paid_message_star_count: int = None,
4344
message_effect_id: int = None,
4445
reply_to_message_id: int = None
4546
) -> list["types.Message"]:
@@ -96,6 +97,9 @@ async def copy_media_group(
9697
allow_paid_broadcast (``bool``, *optional*):
9798
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
9899
100+
paid_message_star_count (``int``, *optional*):
101+
The number of Telegram Stars the user agreed to pay to send the messages.
102+
99103
message_effect_id (``int`` ``64-bit``, *optional*):
100104
Unique identifier of the message effect to be added to the message; for private chats only.
101105
@@ -181,6 +185,7 @@ async def copy_media_group(
181185
schedule_date=utils.datetime_to_timestamp(schedule_date),
182186
noforwards=protect_content,
183187
allow_paid_floodskip=allow_paid_broadcast,
188+
allow_paid_stars=paid_message_star_count,
184189
effect=message_effect_id,
185190
invert_media=any(show_caption_above_media)
186191
),

pyrogram/methods/messages/forward_messages.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ async def forward_messages(
3333
disable_notification: bool = None,
3434
protect_content: bool = None,
3535
allow_paid_broadcast: bool = None,
36+
paid_message_star_count: int = None,
3637
send_copy: bool = None,
3738
remove_caption: bool = None,
3839
video_start_timestamp: int = None,
@@ -70,6 +71,9 @@ async def forward_messages(
7071
allow_paid_broadcast (``bool``, *optional*):
7172
Pass True to allow the message to ignore regular broadcast limits for a fee; for bots only
7273
74+
paid_message_star_count (``int``, *optional*):
75+
The number of Telegram Stars the user agreed to pay to send the messages.
76+
7377
send_copy (``bool``, *optional*):
7478
Pass True to copy content of the messages without reference to the original sender.
7579
@@ -118,6 +122,7 @@ async def forward_messages(
118122
drop_media_captions=remove_caption,
119123
noforwards=protect_content,
120124
allow_paid_floodskip=allow_paid_broadcast,
125+
allow_paid_stars=paid_message_star_count,
121126
random_id=[self.rnd_id() for _ in message_ids],
122127
send_as=await self.resolve_peer(send_as) if send_as else None,
123128
schedule_date=utils.datetime_to_timestamp(schedule_date),

pyrogram/methods/messages/send_animation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ async def send_animation(
5757
schedule_date: datetime = None,
5858
protect_content: bool = None,
5959
allow_paid_broadcast: bool = None,
60+
paid_message_star_count: int = None,
6061
ttl_seconds: int = None,
6162
reply_markup: Union[
6263
"types.InlineKeyboardMarkup",
@@ -156,6 +157,9 @@ async def send_animation(
156157
allow_paid_broadcast (``bool``, *optional*):
157158
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
158159
160+
paid_message_star_count (``int``, *optional*):
161+
The number of Telegram Stars the user agreed to pay to send the messages.
162+
159163
ttl_seconds (``int``, *optional*):
160164
The message will be self-destructed in the specified time after its content was opened.
161165
The message's self-destruct time, in seconds; must be between 0 and 60 in private chats.
@@ -299,6 +303,7 @@ async def progress(current, total):
299303
schedule_date=utils.datetime_to_timestamp(schedule_date),
300304
noforwards=protect_content,
301305
allow_paid_floodskip=allow_paid_broadcast,
306+
allow_paid_stars=paid_message_star_count,
302307
reply_markup=await reply_markup.write(self) if reply_markup else None,
303308
effect=message_effect_id,
304309
invert_media=show_caption_above_media,

pyrogram/methods/messages/send_audio.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ async def send_audio(
5454
schedule_date: datetime = None,
5555
protect_content: bool = None,
5656
allow_paid_broadcast: bool = None,
57+
paid_message_star_count: int = None,
5758
reply_markup: Union[
5859
"types.InlineKeyboardMarkup",
5960
"types.ReplyKeyboardMarkup",
@@ -144,6 +145,9 @@ async def send_audio(
144145
allow_paid_broadcast (``bool``, *optional*):
145146
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
146147
148+
paid_message_star_count (``int``, *optional*):
149+
The number of Telegram Stars the user agreed to pay to send the messages.
150+
147151
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
148152
Additional interface options. An object for an inline keyboard, custom reply keyboard,
149153
instructions to remove reply keyboard or to force a reply from the user.
@@ -268,6 +272,7 @@ async def progress(current, total):
268272
schedule_date=utils.datetime_to_timestamp(schedule_date),
269273
noforwards=protect_content,
270274
allow_paid_floodskip=allow_paid_broadcast,
275+
allow_paid_stars=paid_message_star_count,
271276
reply_markup=await reply_markup.write(self) if reply_markup else None,
272277
effect=message_effect_id,
273278
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)

pyrogram/methods/messages/send_cached_media.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ async def send_cached_media(
4444
schedule_date: datetime = None,
4545
protect_content: bool = None,
4646
allow_paid_broadcast: bool = None,
47+
paid_message_star_count: int = None,
4748
has_spoiler: bool = None,
4849
reply_markup: Union[
4950
"types.InlineKeyboardMarkup",
@@ -116,6 +117,9 @@ async def send_cached_media(
116117
allow_paid_broadcast (``bool``, *optional*):
117118
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
118119
120+
paid_message_star_count (``int``, *optional*):
121+
The number of Telegram Stars the user agreed to pay to send the messages.
122+
119123
has_spoiler (``bool``, *optional*):
120124
True, if the message media is covered by a spoiler animation.
121125
@@ -160,6 +164,7 @@ async def send_cached_media(
160164
schedule_date=utils.datetime_to_timestamp(schedule_date),
161165
noforwards=protect_content,
162166
allow_paid_floodskip=allow_paid_broadcast,
167+
allow_paid_stars=paid_message_star_count,
163168
reply_markup=await reply_markup.write(self) if reply_markup else None,
164169
effect=message_effect_id,
165170
invert_media=show_caption_above_media,

0 commit comments

Comments
 (0)