-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bot API 7.9 #2377
Merged
Merged
Bot API 7.9 #2377
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
77c802c
Update README.md
coder2020official 737e7e4
Update README.md
coder2020official 80cddf0
Added the field paid_media to the class TransactionPartnerUser for tr…
coder2020official 3ff7d5a
Merge branch 'botapi-79' of https://github.com/coder2020official/pyTe…
coder2020official 496cc7c
Added the field paid_media to the class TransactionPartnerUser for t…
coder2020official 80a5b94
added 2 methods
coder2020official d621647
fix
coder2020official 6c45992
added reactiontypepaid
coder2020official 25266a1
use named parameters for creating and editing chat subcription links
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 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 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 |
---|---|---|
|
@@ -3136,7 +3136,8 @@ def send_paid_media( | |
caption: Optional[str]=None, parse_mode: Optional[str]=None, caption_entities: Optional[List[types.MessageEntity]]=None, | ||
show_caption_above_media: Optional[bool]=None, disable_notification: Optional[bool]=None, | ||
protect_content: Optional[bool]=None, reply_parameters: Optional[types.ReplyParameters]=None, | ||
reply_markup: Optional[REPLY_MARKUP_TYPES]=None) -> types.Message: | ||
reply_markup: Optional[REPLY_MARKUP_TYPES]=None, business_connection_id: Optional[str]=None, | ||
) -> types.Message: | ||
""" | ||
Use this method to send paid media to channel chats. On success, the sent Message is returned. | ||
|
||
|
@@ -3175,6 +3176,9 @@ def send_paid_media( | |
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user | ||
:type reply_markup: :class:`telebot.types.InlineKeyboardMarkup` or :class:`telebot.types.ReplyKeyboardMarkup` or :class:`telebot.types.ReplyKeyboardRemove` or :class:`telebot.types.ForceReply` | ||
|
||
:param business_connection_id: Identifier of a business connection, in which the message will be sent | ||
:type business_connection_id: :obj:`str` | ||
|
||
:return: On success, the sent Message is returned. | ||
:rtype: :class:`telebot.types.Message` | ||
""" | ||
|
@@ -3183,7 +3187,7 @@ def send_paid_media( | |
self.token, chat_id, star_count, media, caption=caption, parse_mode=parse_mode, | ||
caption_entities=caption_entities, show_caption_above_media=show_caption_above_media, | ||
disable_notification=disable_notification, protect_content=protect_content, | ||
reply_parameters=reply_parameters, reply_markup=reply_markup) | ||
reply_parameters=reply_parameters, reply_markup=reply_markup, business_connection_id=business_connection_id) | ||
) | ||
|
||
|
||
|
@@ -4195,6 +4199,62 @@ def edit_chat_invite_link( | |
apihelper.edit_chat_invite_link(self.token, chat_id, invite_link, name, expire_date, member_limit, creates_join_request) | ||
) | ||
|
||
def create_chat_subscription_invite_link( | ||
self, chat_id: Union[int, str], subscription_period: int, subscription_price: int, | ||
name: Optional[str]=None) -> types.ChatInviteLink: | ||
""" | ||
Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. | ||
The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. | ||
Returns the new invite link as a ChatInviteLink object. | ||
|
||
Telegram documentation: https://core.telegram.org/bots/api#createchatsubscriptioninvitelink | ||
|
||
:param chat_id: Unique identifier for the target channel chat or username of the target channel | ||
(in the format @channelusername) | ||
:type chat_id: :obj:`int` or :obj:`str` | ||
|
||
:param name: Invite link name; 0-32 characters | ||
:type name: :obj:`str` | ||
|
||
:param subscription_period: The number of seconds the subscription will be active for before the next payment. | ||
Currently, it must always be 2592000 (30 days). | ||
:type subscription_period: :obj:`int` | ||
|
||
:param subscription_price: The amount of Telegram Stars a user must pay initially and after each subsequent | ||
subscription period to be a member of the chat; 1-2500 | ||
:type subscription_price: :obj:`int` | ||
|
||
:return: Returns the new invite link as a ChatInviteLink object. | ||
:rtype: :class:`telebot.types.ChatInviteLink` | ||
""" | ||
return types.ChatInviteLink.de_json( | ||
apihelper.create_chat_subscription_invite_link(self.token, chat_id, subscription_period, subscription_price, name) | ||
) | ||
|
||
def edit_chat_subscription_invite_link( | ||
self, chat_id: Union[int, str], invite_link: str, name: Optional[str]=None) -> types.ChatInviteLink: | ||
""" | ||
Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. | ||
Returns the edited invite link as a ChatInviteLink object. | ||
|
||
Telegram documentation: https://core.telegram.org/bots/api#editchatsubscriptioninvitelink | ||
|
||
:param chat_id: Unique identifier for the target chat or username of the target channel | ||
(in the format @channelusername) | ||
:type chat_id: :obj:`int` or :obj:`str` | ||
|
||
:param invite_link: The invite link to edit | ||
:type invite_link: :obj:`str` | ||
|
||
:param name: Invite link name; 0-32 characters | ||
:type name: :obj:`str` | ||
|
||
:return: Returns the edited invite link as a ChatInviteLink object. | ||
:rtype: :class:`telebot.types.ChatInviteLink` | ||
""" | ||
return types.ChatInviteLink.de_json( | ||
apihelper.edit_chat_subscription_invite_link(self.token, chat_id, invite_link, name) | ||
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. 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. In ASYNC also in 2 places. |
||
) | ||
|
||
def revoke_chat_invite_link( | ||
self, chat_id: Union[int, str], invite_link: str) -> types.ChatInviteLink: | ||
|
This file contains 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 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 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 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
Oops, something went wrong.
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.
I propose to make optional parameters named.
... name=name
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.
just the name?