@@ -1827,7 +1827,8 @@ def forward_message(
18271827 message_thread_id : Optional [int ]= None ,
18281828 video_start_timestamp : Optional [int ]= None ,
18291829 direct_messages_topic_id : Optional [int ]= None ,
1830- suggested_post_parameters : Optional [types .SuggestedPostParameters ]= None ) -> types .Message :
1830+ suggested_post_parameters : Optional [types .SuggestedPostParameters ]= None ,
1831+ message_effect_id : Optional [str ]= None ) -> types .Message :
18311832 """
18321833 Use this method to forward messages of any kind.
18331834
@@ -1866,6 +1867,9 @@ def forward_message(
18661867 is automatically declined.
18671868 :type suggested_post_parameters: :class:`telebot.types.SuggestedPostParameters`
18681869
1870+ :param message_effect_id: Unique identifier of the message effect to be added to the message; only available when forwarding to private chats
1871+ :type message_effect_id: :obj:`str`
1872+
18691873 :return: On success, the sent Message is returned.
18701874 :rtype: :class:`telebot.types.Message`
18711875 """
@@ -1877,7 +1881,7 @@ def forward_message(
18771881 self .token , chat_id , from_chat_id , message_id , disable_notification = disable_notification ,
18781882 timeout = timeout , protect_content = protect_content , message_thread_id = message_thread_id ,
18791883 video_start_timestamp = video_start_timestamp , direct_messages_topic_id = direct_messages_topic_id ,
1880- suggested_post_parameters = suggested_post_parameters
1884+ suggested_post_parameters = suggested_post_parameters , message_effect_id = message_effect_id
18811885 )
18821886 )
18831887
@@ -1901,7 +1905,8 @@ def copy_message(
19011905 allow_paid_broadcast : Optional [bool ]= None ,
19021906 video_start_timestamp : Optional [int ]= None ,
19031907 direct_messages_topic_id : Optional [int ]= None ,
1904- suggested_post_parameters : Optional [types .SuggestedPostParameters ]= None ) -> types .MessageID :
1908+ suggested_post_parameters : Optional [types .SuggestedPostParameters ]= None ,
1909+ message_effect_id : Optional [str ]= None ) -> types .MessageID :
19051910 """
19061911 Use this method to copy messages of any kind.
19071912 Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
@@ -1973,6 +1978,9 @@ def copy_message(
19731978 is automatically declined.
19741979 :type suggested_post_parameters: :class:`telebot.types.SuggestedPostParameters`
19751980
1981+ :param message_effect_id: Unique identifier of the message effect to be added to the message; only available when copying to private chats
1982+ :type message_effect_id: :obj:`str`
1983+
19761984 :return: On success, the MessageId of the sent message is returned.
19771985 :rtype: :class:`telebot.types.MessageID`
19781986 """
@@ -2006,7 +2014,7 @@ def copy_message(
20062014 message_thread_id = message_thread_id , reply_parameters = reply_parameters ,
20072015 show_caption_above_media = show_caption_above_media , allow_paid_broadcast = allow_paid_broadcast ,
20082016 video_start_timestamp = video_start_timestamp , direct_messages_topic_id = direct_messages_topic_id ,
2009- suggested_post_parameters = suggested_post_parameters
2017+ suggested_post_parameters = suggested_post_parameters , message_effect_id = message_effect_id
20102018 ))
20112019
20122020
@@ -4195,6 +4203,45 @@ def send_contact(
41954203 business_connection_id = business_connection_id , message_effect_id = message_effect_id , allow_paid_broadcast = allow_paid_broadcast ,
41964204 direct_messages_topic_id = direct_messages_topic_id , suggested_post_parameters = suggested_post_parameters )
41974205 )
4206+
4207+
4208+ def send_message_draft (
4209+ self , chat_id : int ,
4210+ draft_id : int ,
4211+ text : str ,
4212+ message_thread_id : Optional [int ]= None ,
4213+ parse_mode : Optional [str ]= None ,
4214+ entities : Optional [List [types .MessageEntity ]]= None ):
4215+ """
4216+ Use this method to stream a partial message to a user while the message is being generated;
4217+ supported only for bots with forum topic mode enabled. Returns True on success.
4218+
4219+ Telegram documentation: https://core.telegram.org/bots/api#sendmessagedraft
4220+
4221+ :param chat_id: Unique identifier for the target private chat
4222+ :type chat_id: :obj:`int`
4223+
4224+ :param message_thread_id: Unique identifier for the target message thread
4225+ :type message_thread_id: :obj:`int`
4226+
4227+ :param draft_id: Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
4228+ :type draft_id: :obj:`int`
4229+
4230+ :param text: Text of the message to be sent, 1-4096 characters after entities parsing
4231+ :type text: :obj:`str`
4232+
4233+ :param parse_mode: Mode for parsing entities in the message text. See formatting options for more details.
4234+ :type parse_mode: :obj:`str`
4235+
4236+ :param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
4237+ :type entities: :obj:`list` of :class:`telebot.types.MessageEntity
4238+
4239+ :return: Returns True on success.
4240+ :rtype: :obj:`bool`
4241+ """
4242+ return apihelper .send_message_draft (
4243+ self .token , chat_id , draft_id , text , parse_mode = parse_mode , entities = entities , message_thread_id = message_thread_id )
4244+
41984245
41994246
42004247 def send_chat_action (
@@ -4222,7 +4269,7 @@ def send_chat_action(
42224269 :param timeout: Timeout in seconds for the request.
42234270 :type timeout: :obj:`int`
42244271
4225- :param message_thread_id: The thread identifier of a message from which the reply will be sent(supergroups only )
4272+ :param message_thread_id: The thread identifier of a message from which the reply will be sent(for supergroups and private chats )
42264273 :type message_thread_id: :obj:`int`
42274274
42284275 :param business_connection_id: Identifier of a business connection
@@ -6909,7 +6956,10 @@ def get_business_account_gifts(
69096956 exclude_unique : Optional [bool ]= None ,
69106957 sort_by_price : Optional [bool ]= None ,
69116958 offset : Optional [str ]= None ,
6912- limit : Optional [int ]= None ) -> types .OwnedGifts :
6959+ limit : Optional [int ]= None ,
6960+ exclude_limited_upgradable : Optional [bool ]= None ,
6961+ exclude_limited_non_upgradable : Optional [bool ]= None ,
6962+ exclude_from_blockchain : Optional [bool ]= None ,) -> types .OwnedGifts :
69136963 """
69146964 Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.
69156965
@@ -6927,12 +6977,15 @@ def get_business_account_gifts(
69276977 :param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
69286978 :type exclude_unlimited: :obj:`bool`
69296979
6930- :param exclude_limited: Pass True to exclude gifts that can be purchased a limited number of times
6980+ :param exclude_limited: Deprecated, use exclude_limited_upgradable and exclude_limited_non_upgradable instead.
69316981 :type exclude_limited: :obj:`bool`
69326982
69336983 :param exclude_unique: Pass True to exclude unique gifts
69346984 :type exclude_unique: :obj:`bool`
69356985
6986+ :param exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
6987+ :type exclude_from_blockchain: :obj:`bool`
6988+
69366989 :param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
69376990 :type sort_by_price: :obj:`bool`
69386991
@@ -6942,23 +6995,171 @@ def get_business_account_gifts(
69426995 :param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
69436996 :type limit: :obj:`int`
69446997
6998+ :param exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
6999+ :type exclude_limited_upgradable: :obj:`bool`
7000+
7001+ :param exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
7002+ :type exclude_limited_non_upgradable: :obj:`bool`
7003+
69457004 :return: On success, a OwnedGifts object is returned.
69467005 :rtype: :class:`telebot.types.OwnedGifts`
69477006 """
7007+
7008+ if exclude_limited is not None :
7009+ logger .warning ("Deprecation warning. 'exclude_limited' parameter is deprecated in get_business_account_gifts. Use 'exclude_limited_upgradable' and 'exclude_limited_non_upgradable' instead." )
7010+
7011+ if exclude_limited_upgradable is not None or exclude_limited_non_upgradable is not None :
7012+ logger .warning ("Both 'exclude_limited' and 'exclude_limited_upgradable'/'exclude_limited_non_upgradable' parameters are set: conflicting, using 'exclude_limited_upgradable' and 'exclude_limited_non_upgradable' values." )
7013+
7014+ else :
7015+ exclude_limited_upgradable = exclude_limited
7016+ exclude_limited_non_upgradable = exclude_limited
7017+
69487018 return types .OwnedGifts .de_json (
69497019 apihelper .get_business_account_gifts (
69507020 self .token , business_connection_id ,
69517021 exclude_unsaved = exclude_unsaved ,
69527022 exclude_saved = exclude_saved ,
69537023 exclude_unlimited = exclude_unlimited ,
6954- exclude_limited = exclude_limited ,
7024+ exclude_unique = exclude_unique ,
7025+ sort_by_price = sort_by_price ,
7026+ offset = offset ,
7027+ limit = limit ,
7028+ exclude_limited_upgradable = exclude_limited_upgradable ,
7029+ exclude_limited_non_upgradable = exclude_limited_non_upgradable ,
7030+ exclude_from_blockchain = exclude_from_blockchain
7031+ )
7032+ )
7033+
7034+ def get_user_gifts (
7035+ self , user_id : int ,
7036+ exclude_unlimited : Optional [bool ]= None ,
7037+ exclude_limited_upgradable : Optional [bool ]= None ,
7038+ exclude_limited_non_upgradable : Optional [bool ]= None ,
7039+ exclude_from_blockchain : Optional [bool ]= None ,
7040+ exclude_unique : Optional [bool ]= None ,
7041+ sort_by_price : Optional [bool ]= None ,
7042+ offset : Optional [str ]= None ,
7043+ limit : Optional [int ]= None ) -> types .OwnedGifts :
7044+ """
7045+ Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.
7046+
7047+ Telegram documentation: https://core.telegram.org/bots/api#getusergifts
7048+
7049+ :param user_id: Unique identifier of the user
7050+ :type user_id: :obj:`int`
7051+
7052+ :param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
7053+ :type exclude_unlimited: :obj:`bool`
7054+
7055+ :param exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
7056+ :type exclude_limited_upgradable: :obj:`bool`
7057+
7058+ :param exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
7059+ :type exclude_limited_non_upgradable: :obj:`bool`
7060+
7061+ :param exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
7062+ :type exclude_from_blockchain: :obj:`bool`
7063+
7064+ :param exclude_unique: Pass True to exclude unique gifts
7065+ :type exclude_unique: :obj:`bool`
7066+
7067+ :param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
7068+ :type sort_by_price: :obj:`bool`
7069+
7070+ :param offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
7071+ :type offset: :obj:`str`
7072+
7073+ :param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
7074+ :type limit: :obj:`int`
7075+
7076+ :return: On success, a OwnedGifts object is returned.
7077+ :rtype: :class:`telebot.types.OwnedGifts`
7078+ """
7079+ return types .OwnedGifts .de_json (
7080+ apihelper .get_user_gifts (
7081+ self .token , user_id ,
7082+ exclude_unlimited = exclude_unlimited ,
7083+ exclude_limited_upgradable = exclude_limited_upgradable ,
7084+ exclude_limited_non_upgradable = exclude_limited_non_upgradable ,
7085+ exclude_from_blockchain = exclude_from_blockchain ,
7086+ exclude_unique = exclude_unique ,
7087+ sort_by_price = sort_by_price ,
7088+ offset = offset ,
7089+ limit = limit
7090+ )
7091+ )
7092+
7093+ def get_chat_gifts (
7094+ self , chat_id : Union [int , str ],
7095+ exclude_unsaved : Optional [bool ]= None ,
7096+ exclude_saved : Optional [bool ]= None ,
7097+ exclude_unlimited : Optional [bool ]= None ,
7098+ exclude_limited_upgradable : Optional [bool ]= None ,
7099+ exclude_limited_non_upgradable : Optional [bool ]= None ,
7100+ exclude_from_blockchain : Optional [bool ]= None ,
7101+ exclude_unique : Optional [bool ]= None ,
7102+ sort_by_price : Optional [bool ]= None ,
7103+ offset : Optional [str ]= None ,
7104+ limit : Optional [int ]= None ) -> types .OwnedGifts :
7105+ """
7106+ Returns the gifts owned by a chat. Returns OwnedGifts on success.
7107+
7108+ Telegram documentation: https://core.telegram.org/bots/api#getchatgifts
7109+
7110+ :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
7111+ :type chat_id: :obj:`int` | :obj:`str`
7112+
7113+ :param exclude_unsaved: Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel.
7114+ :type exclude_unsaved: :obj:`bool`
7115+
7116+ :param exclude_saved: Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel.
7117+ :type exclude_saved: :obj:`bool`
7118+
7119+ :param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
7120+ :type exclude_unlimited: :obj:`bool`
7121+
7122+ :param exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
7123+ :type exclude_limited_upgradable: :obj:`bool`
7124+
7125+ :param exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
7126+ :type exclude_limited_non_upgradable: :obj:`bool`
7127+
7128+ :param exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
7129+ :type exclude_from_blockchain: :obj:`bool`
7130+
7131+ :param exclude_unique: Pass True to exclude unique gifts
7132+ :type exclude_unique: :obj:`bool`
7133+
7134+ :param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
7135+ :type sort_by_price: :obj:`bool`
7136+
7137+ :param offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
7138+ :type offset: :obj:`str`
7139+
7140+ :param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
7141+ :type limit: :obj:`int`
7142+
7143+ :return: On success, a OwnedGifts object is returned.
7144+ :rtype: :class:`telebot.types.OwnedGifts`
7145+ """
7146+ return types .OwnedGifts .de_json (
7147+ apihelper .get_chat_gifts (
7148+ self .token , chat_id ,
7149+ exclude_unsaved = exclude_unsaved ,
7150+ exclude_saved = exclude_saved ,
7151+ exclude_unlimited = exclude_unlimited ,
7152+ exclude_limited_upgradable = exclude_limited_upgradable ,
7153+ exclude_limited_non_upgradable = exclude_limited_non_upgradable ,
7154+ exclude_from_blockchain = exclude_from_blockchain ,
69557155 exclude_unique = exclude_unique ,
69567156 sort_by_price = sort_by_price ,
69577157 offset = offset ,
69587158 limit = limit
69597159 )
69607160 )
69617161
7162+
69627163 def convert_gift_to_stars (self , business_connection_id : str , owned_gift_id : str ) -> bool :
69637164 """
69647165 Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.
@@ -7096,6 +7297,50 @@ def post_story(
70967297 )
70977298 )
70987299
7300+ def repost_story (
7301+ self , business_connection_id : str ,
7302+ from_chat_id : int , from_story_id : int ,
7303+ active_period : int ,
7304+ post_to_chat_page : Optional [bool ]= None ,
7305+ protect_content : Optional [bool ]= None ) -> types .Story :
7306+ """
7307+ Reposts a story on behalf of a business account from another business account. Both business accounts
7308+ must be managed by the same bot, and the story on the source account must have been posted (or reposted)
7309+ by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.
7310+
7311+ Telegram documentation: https://core.telegram.org/bots/api#repoststory
7312+
7313+ :param business_connection_id: Unique identifier of the business connection
7314+ :type business_connection_id: :obj:`str`
7315+
7316+ :param from_chat_id: Unique identifier of the chat which posted the story that should be reposted
7317+ :type from_chat_id: :obj:`int`
7318+
7319+ :param from_story_id: Unique identifier of the story that should be reposted
7320+ :type from_story_id: :obj:`int`
7321+
7322+ :param active_period: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
7323+ :type active_period: :obj:`int`
7324+
7325+ :param post_to_chat_page: Pass True to keep the story accessible after it expires
7326+ :type post_to_chat_page: :obj:`bool`
7327+
7328+ :param protect_content: Pass True if the content of the story must be protected from forwarding and screenshotting
7329+ :type protect_content: :obj:`bool`
7330+
7331+ :return: On success, a Story object is returned.
7332+ :rtype: :class:`telebot.types.Story`
7333+ """
7334+ return types .Story .de_json (
7335+ apihelper .repost_story (
7336+ self .token , business_connection_id ,
7337+ from_chat_id , from_story_id ,
7338+ active_period ,
7339+ post_to_chat_page = post_to_chat_page ,
7340+ protect_content = protect_content
7341+ )
7342+ )
7343+
70997344 def edit_story (
71007345 self , business_connection_id : str , story_id : int ,
71017346 content : types .InputStoryContent ,
0 commit comments