Skip to content

Commit edaf91c

Browse files
authored
Merge branch 'dev' into mc
2 parents 15648f4 + bf7491a commit edaf91c

30 files changed

+301
-99
lines changed

compiler/api/source/main_api.tl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ updateStarsBalance#4e80a379 balance:StarsAmount = Update;
477477
updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long connection_id:string message:Message reply_to_message:flags.2?Message chat_instance:long data:flags.0?bytes = Update;
478478
updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update;
479479
updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update;
480-
updatePaidReactionPrivacy#51ca7aec private:Bool = Update;
480+
updatePaidReactionPrivacy#8b725fce private:PaidReactionPrivacy = Update;
481481

482482
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
483483

@@ -650,7 +650,7 @@ messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMess
650650

651651
webPageEmpty#211a1788 flags:# id:long url:flags.0?string = WebPage;
652652
webPagePending#b0d13e47 flags:# id:long url:flags.0?string date:int = WebPage;
653-
webPage#e89c45b2 flags:# has_large_media:flags.13?true id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage;
653+
webPage#e89c45b2 flags:# has_large_media:flags.13?true video_cover_photo:flags.14?true id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page attributes:flags.12?Vector<WebPageAttribute> = WebPage;
654654
webPageNotModified#7311ca11 flags:# cached_page_views:flags.0?int = WebPage;
655655

656656
authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true password_pending:flags.2?true encrypted_requests_disabled:flags.3?true call_requests_disabled:flags.4?true unconfirmed:flags.5?true hash:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization;
@@ -1928,7 +1928,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true
19281928
starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;
19291929

19301930
starGift#2cc73c8 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long = StarGift;
1931-
starGiftUnique#f2fe7e4a flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int = StarGift;
1931+
starGiftUnique#5c62d151 flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int gift_address:flags.3?string = StarGift;
19321932

19331933
payments.starGiftsNotModified#a388a368 = payments.StarGifts;
19341934
payments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts;
@@ -1985,6 +1985,10 @@ inputSavedStarGiftChat#f101aa7f peer:InputPeer saved_id:long = InputSavedStarGif
19851985

19861986
payments.starGiftWithdrawalUrl#84aa3a9c url:string = payments.StarGiftWithdrawalUrl;
19871987

1988+
paidReactionPrivacyDefault#206ad49e = PaidReactionPrivacy;
1989+
paidReactionPrivacyAnonymous#1f0c1ad9 = PaidReactionPrivacy;
1990+
paidReactionPrivacyPeer#dc6cfcf0 peer:InputPeer = PaidReactionPrivacy;
1991+
19881992
---functions---
19891993

19901994
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@@ -1997,6 +2001,7 @@ invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
19972001
invokeWithBusinessConnection#dd289f8e {X:Type} connection_id:string query:!X = X;
19982002
invokeWithGooglePlayIntegrity#1df92984 {X:Type} nonce:string token:string query:!X = X;
19992003
invokeWithApnsSecret#0dae54f8 {X:Type} nonce:string secret:string query:!X = X;
2004+
invokeWithReCaptcha#adbb0f94 {X:Type} token:string query:!X = X;
20002005

20012006
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
20022007
auth.signUp#aac7b717 flags:# no_joined_notifications:flags.0?true phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
@@ -2382,8 +2387,8 @@ messages.editFactCheck#589ee75 peer:InputPeer msg_id:int text:TextWithEntities =
23822387
messages.deleteFactCheck#d1da940c peer:InputPeer msg_id:int = Updates;
23832388
messages.getFactCheck#b9cdc5ee peer:InputPeer msg_id:Vector<int> = Vector<FactCheck>;
23842389
messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:flags.8?true peer:InputPeer bot:InputUser start_param:flags.1?string theme_params:flags.0?DataJSON platform:string = WebViewResult;
2385-
messages.sendPaidReaction#9dd6a67b flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?Bool = Updates;
2386-
messages.togglePaidReactionPrivacy#849ad397 peer:InputPeer msg_id:int private:Bool = Bool;
2390+
messages.sendPaidReaction#58bbcb50 flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?PaidReactionPrivacy = Updates;
2391+
messages.togglePaidReactionPrivacy#435885b5 peer:InputPeer msg_id:int private:PaidReactionPrivacy = Bool;
23872392
messages.getPaidReactionPrivacy#472455aa = Updates;
23882393
messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool;
23892394
messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool;
@@ -2474,7 +2479,7 @@ channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint addr
24742479
channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates;
24752480
channels.getInactiveChannels#11e831ee = messages.InactiveChats;
24762481
channels.convertToGigagroup#b290c69 channel:InputChannel = Updates;
2477-
channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers;
2482+
channels.getSendAs#e785a43f flags:# for_paid_reactions:flags.0?true peer:InputPeer = channels.SendAsPeers;
24782483
channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory;
24792484
channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates;
24802485
channels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates;
@@ -2706,5 +2711,6 @@ fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.Col
27062711
// invokeWithBusinessConnectionPrefix#dd289f8e connection_id:string = Error;
27072712
// invokeWithGooglePlayIntegrityPrefix#1df92984 nonce:string token:string = Error;
27082713
// invokeWithApnsSecretPrefix#0dae54f8 nonce:string secret:string = Error;
2714+
// invokeWithReCaptchaPrefix#adbb0f94 token:string = Error;
27092715

2710-
// LAYER 198
2716+
// LAYER 199

compiler/docs/compiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,10 @@ def get_title_list(s: str) -> list:
677677
ShippingQuery
678678
PreCheckoutQuery
679679
StarAmount
680+
PaidReactionType
681+
PaidReactionTypeAnonymous
682+
PaidReactionTypeChat
683+
PaidReactionTypeRegular
680684
"""
681685
)
682686

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Breaking Changes in this Fork
2525
Changes in this Fork
2626
=====================
2727

28+
+------------------------+
29+
| Scheme layer used: 199 |
30+
+------------------------+
31+
32+
- View `new and changed <https://telegramplayground.github.io/TG-APIs/TL/diff/tdlib.html?from=198&to=199>`__ `raw API methods <https://telegramplayground.github.io/TG-APIs/TL/diff/tdesktop.html?from=198&to=199>`__.
33+
2834
+------------------------+
2935
| Scheme layer used: 198 |
3036
+------------------------+
@@ -33,7 +39,7 @@ Changes in this Fork
3339
- Added ``message.content`` property.
3440
- Added the parameter ``pinned`` and made the parameter ``chat_id`` optional in :meth:`~pyrogram.Client.get_messages`. **NOTE**: Please be aware about using the correct :doc:`Message Identifiers <../../topics/message-identifiers>`, when using this method.
3541
- Added the ``cover`` and ``start_timestamp`` parameters in :meth:`~pyrogram.Client.send_video` and :obj:`~pyrogram.types.InputPaidMediaVideo`.
36-
- Added the ``new_video_start_timestamp`` and renamed the ``send_copy`` and ``remove_caption`` parameters in :meth:`~pyrogram.Client.forward_messages` and :meth:`~pyrogram.types.Message.forward`.
42+
- Added the ``video_start_timestamp`` and renamed the ``send_copy`` and ``remove_caption`` parameters in :meth:`~pyrogram.Client.forward_messages` and :meth:`~pyrogram.types.Message.forward`.
3743
- Added the ``gift_count`` to the :obj:`~pyrogram.types.Chat`.
3844
- Added the :meth:`~pyrogram.Client.get_similar_bots`.
3945
- Changed types in :obj:`~pyrogram.types.UpgradedGift`, :obj:`~pyrogram.types.UserGift`.

pyrogram/methods/business/get_available_gifts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def get_available_gifts(
3131
.. include:: /_includes/usable-by/users-bots.rst
3232
3333
Returns:
34-
List of :obj:`~pyrogram.types.Gift` | :obj:`~pyrogram.types.UpgradedGift`: On success, a list of star gifts is returned.
34+
List of :obj:`~pyrogram.types.Gift` | :obj:`~pyrogram.types.UpgradedGift`: On success, a list of star gifts that can be sent by the Client to users and channel chats is returned.
3535
3636
Example:
3737
.. code-block:: python

pyrogram/methods/business/send_gift.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,32 @@
2626
class SendGift:
2727
async def send_gift(
2828
self: "pyrogram.Client",
29-
user_id: Union[int, str],
30-
gift_id: int,
29+
*,
30+
user_id: Union[int, str] = None,
31+
chat_id: Union[int, str] = None,
32+
gift_id: int = None,
3133
pay_for_upgrade: Optional[bool] = None,
3234
text: Optional[str] = None,
33-
parse_mode: Optional["enums.ParseMode"] = None,
34-
entities: Optional[list["types.MessageEntity"]] = None,
35+
text_parse_mode: Optional["enums.ParseMode"] = None,
36+
text_entities: Optional[list["types.MessageEntity"]] = None,
3537
is_private: Optional[bool] = None,
3638
) -> bool:
37-
"""Sends a gift to another user.
39+
"""Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver.
3840
3941
.. include:: /_includes/usable-by/users-bots.rst
4042
43+
You must use exactly one of ``user_id`` OR ``chat_id``.
44+
4145
Parameters:
4246
user_id (``int`` | ``str``):
43-
Unique identifier (int) or username (str) of the user that will receive the gift.
47+
Required if ``chat_id`` is not specified.
48+
Unique identifier (int) or username (str) of the target user that will receive the gift.
49+
For your personal cloud (Saved Messages) you can simply use "me" or "self".
50+
For a contact that exists in your Telegram address book you can use his phone number (str).
51+
52+
chat_id (``int`` | ``str``):
53+
Required if ``user_id`` is not specified.
54+
Unique identifier (int) or username (str) for the chat or username of the channel that will receive the gift.
4455
For your personal cloud (Saved Messages) you can simply use "me" or "self".
4556
For a contact that exists in your Telegram address book you can use his phone number (str).
4657
@@ -53,12 +64,12 @@ async def send_gift(
5364
text (``str``, *optional*):
5465
Text that will be shown along with the gift. 0-``gift_text_length_max`` characters.
5566
56-
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
67+
text_parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
5768
By default, texts are parsed using both Markdown and HTML styles.
5869
You can combine both syntaxes together.
5970
60-
entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
61-
List of special entities that appear in message text, which can be specified instead of *parse_mode*.
71+
text_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
72+
List of special entities that appear in message text, which can be specified instead of *text_parse_mode*.
6273
Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed.
6374
6475
is_private (``bool``, *optional*):
@@ -77,12 +88,15 @@ async def send_gift(
7788
app.send_gift(user_id=user_id, gift_id=123)
7889
7990
"""
80-
peer = await self.resolve_peer(user_id)
81-
82-
if not isinstance(peer, (raw.types.InputPeerUser, raw.types.InputPeerSelf)):
83-
raise ValueError("user_id must belong to a user.")
84-
85-
text, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
91+
peer = None
92+
if user_id:
93+
peer = await self.resolve_peer(user_id)
94+
elif chat_id:
95+
peer = await self.resolve_peer(chat_id)
96+
# TODO
97+
if not peer:
98+
raise ValueError("You must use exactly one of user_id OR chat_id")
99+
text, entities = (await utils.parse_text_entities(self, text, text_parse_mode, text_entities)).values()
86100

87101
invoice = raw.types.InputInvoiceStarGift(
88102
user_id=peer,

pyrogram/methods/chats/get_send_as_chats.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class GetSendAsChats:
2727
async def get_send_as_chats(
2828
self: "pyrogram.Client",
29-
chat_id: Union[int, str]
29+
chat_id: Union[int, str],
3030
) -> list["types.Chat"]:
3131
"""Get the list of "send_as" chats available.
3232
@@ -44,10 +44,11 @@ async def get_send_as_chats(
4444
4545
chats = await app.get_send_as_chats(chat_id)
4646
print(chats)
47+
4748
"""
4849
r = await self.invoke(
4950
raw.functions.channels.GetSendAs(
50-
peer=await self.resolve_peer(chat_id)
51+
peer=await self.resolve_peer(chat_id),
5152
)
5253
)
5354

pyrogram/methods/messages/add_paid_message_reaction.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@
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-
import logging
2019
from typing import Union
2120

2221
import pyrogram
2322
from pyrogram import raw, types
2423

25-
log = logging.getLogger(__name__)
26-
2724

2825
class AddPaidMessageReaction:
2926
async def add_paid_message_reaction(
3027
self: "pyrogram.Client",
3128
chat_id: Union[int, str],
3229
message_id: int,
3330
star_count: int = None,
34-
is_anonymous: bool = False
31+
paid_reaction_type: "types.PaidReactionType" = None
3532
) -> "types.MessageReactions":
3633
"""Adds the paid message reaction to a message.
3734
@@ -47,9 +44,8 @@ async def add_paid_message_reaction(
4744
star_count (``int``, *optional*):
4845
Number of Telegram Stars to be used for the reaction; 1-2500.
4946
50-
is_anonymous (``bool``, *optional*):
51-
Pass True to make paid reaction of the user on the message anonymous; pass False to make the user's profile visible among top reactors.
52-
Defaults to False.
47+
paid_reaction_type (:obj:`~pyrogram.types.PaidReactionType`, *optional*):
48+
Type of the paid reaction; pass None if the user didn't choose reaction type explicitly, for example, the reaction is set from the message bubble.
5349
5450
Returns:
5551
On success, :obj:`~pyrogram.types.MessageReactions`: is returned.
@@ -58,7 +54,7 @@ async def add_paid_message_reaction(
5854
.. code-block:: python
5955
6056
# Add a paid reaction to a message
61-
await app.add_paid_message_reaction(chat_id, message_id, 1, False)
57+
await app.add_paid_message_reaction(chat_id, message_id, 1)
6258
6359
"""
6460

@@ -68,7 +64,7 @@ async def add_paid_message_reaction(
6864
msg_id=message_id,
6965
random_id=self.rnd_id(),
7066
count=star_count,
71-
private=is_anonymous
67+
private=await paid_reaction_type.write(self) if paid_reaction_type else None
7268
)
7369
)
7470
for i in r.updates:

pyrogram/methods/messages/forward_messages.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def forward_messages(
3636
allow_paid_broadcast: bool = None,
3737
send_copy: bool = None,
3838
remove_caption: bool = None,
39-
new_video_start_timestamp: int = None,
39+
video_start_timestamp: int = None,
4040
send_as: Union[int, str] = None,
4141
schedule_date: datetime = None
4242
) -> Union["types.Message", list["types.Message"]]:
@@ -77,8 +77,8 @@ async def forward_messages(
7777
remove_caption (``bool``, *optional*):
7878
Pass True to remove media captions of message copies.
7979
80-
new_video_start_timestamp (``int``, *optional*):
81-
The new video start timestamp. Pass time to replace video start timestamp in the forwarded message.
80+
video_start_timestamp (``int``, *optional*):
81+
New start timestamp for the forwarded video in the message.
8282
8383
send_as (``int`` | ``str``):
8484
Unique identifier (int) or username (str) of the chat or channel to send the message as.
@@ -114,7 +114,7 @@ async def forward_messages(
114114
id=message_ids,
115115
silent=disable_notification or None,
116116
# TODO
117-
video_timestamp=new_video_start_timestamp,
117+
video_timestamp=video_start_timestamp,
118118
drop_author=send_copy,
119119
drop_media_captions=remove_caption,
120120
noforwards=protect_content,

0 commit comments

Comments
 (0)