-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bot API 8.3 Update #2453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Bot API 8.3 Update #2453
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
36b2753
added chat_id to send_gift, user_id made optional;
coder2020official d7c2a32
Added can_send_gift to ChatFullInfo
coder2020official eb2cfd2
Added TransactionPartnerChat
coder2020official 73f34d3
Added the fields cover and start_timestamp to the class Video, contai…
coder2020official fcee398
Added the parameters cover and start_timestamp to the method sendVide…
coder2020official 1ccc966
Added the fields cover and start_timestamp to the classes InputMediaV…
coder2020official 56d14dc
Added the parameter video_start_timestamp to the methods forwardMessa…
coder2020official d5c28da
Update Bot API Version
coder2020official 7d82d8f
Ensure backward compatibility for send_gift
coder2020official File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7707,19 +7707,24 @@ async def delete_sticker_set(self, name:str) -> bool: | |
|
|
||
| return await asyncio_helper.delete_sticker_set(self.token, name) | ||
|
|
||
| async def send_gift(self, user_id: int, gift_id: str, text: Optional[str]=None, text_parse_mode: Optional[str]=None, | ||
| text_entities: Optional[List[types.MessageEntity]]=None, pay_for_upgrade: Optional[bool]=None) -> bool: | ||
| async def send_gift(self, gift_id: str, user_id: Optional[Union[str, int]] = None, chat_id: Optional[Union[str, int]] = None, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here: not possible to change fixed parameters order. :( |
||
| text: Optional[str]=None, text_parse_mode: Optional[str]=None, text_entities: Optional[List[types.MessageEntity]]=None, | ||
| pay_for_upgrade: Optional[bool]=None) -> bool: | ||
| """ | ||
| Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success. | ||
|
|
||
| Telegram documentation: https://core.telegram.org/bots/api#sendgift | ||
|
|
||
| :param user_id: Unique identifier of the target user that will receive the gift | ||
| :type user_id: :obj:`int` | ||
|
|
||
| :param gift_id: Identifier of the gift | ||
| :type gift_id: :obj:`str` | ||
|
|
||
| :param user_id: Required if chat_id is not specified. Unique identifier of the target user who will receive the gift. | ||
| :type user_id::obj:`int` | :obj:`str` | ||
|
|
||
| :param chat_id: Required if user_id is not specified. Unique identifier for the chat or username of the channel | ||
| (in the format @channelusername) that will receive the gift. | ||
| :type chat_id: :obj:`int` | :obj:`str` | ||
|
|
||
| :param pay_for_upgrade: Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver | ||
| :type pay_for_upgrade: :obj:`bool` | ||
|
|
||
|
|
@@ -7735,7 +7740,11 @@ async def send_gift(self, user_id: int, gift_id: str, text: Optional[str]=None, | |
| :return: Returns True on success. | ||
| :rtype: :obj:`bool` | ||
| """ | ||
| return await asyncio_helper.send_gift(self.token, user_id, gift_id, text, text_parse_mode, text_entities, pay_for_upgrade=pay_for_upgrade) | ||
| if user_id is None and chat_id is None: | ||
| raise ValueError("Either user_id or chat_id must be specified.") | ||
|
|
||
| return await asyncio_helper.send_gift(self.token, gift_id, text, text_parse_mode, text_entities, pay_for_upgrade=pay_for_upgrade, | ||
| chat_id=chat_id, user_id=user_id) | ||
|
|
||
| async def verify_user(self, user_id: int, custom_description: Optional[str]=None) -> bool: | ||
| """ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot change order of fixed parameters or ones who had been fixed. :(((
In this case I propose to make all parameters optional and check inside gift_id to be not None. Or even not check: Telegram will return error himself.
Mark in manual, that gift_id IS NOT optional in fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get annoyed to see how we are still 'outdated' from the API. Will fix it :(