diff --git a/telebot/__init__.py b/telebot/__init__.py index a7071438e..6a874ea9e 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -3146,6 +3146,7 @@ def send_paid_media( 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, business_connection_id: Optional[str]=None, + payload: Optional[str]=None ) -> types.Message: """ Use this method to send paid media to channel chats. On success, the sent Message is returned. @@ -3188,6 +3189,9 @@ def send_paid_media( :param business_connection_id: Identifier of a business connection, in which the message will be sent :type business_connection_id: :obj:`str` + :param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. + :type payload: :obj:`str` + :return: On success, the sent Message is returned. :rtype: :class:`telebot.types.Message` """ @@ -3196,7 +3200,8 @@ 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, business_connection_id=business_connection_id) + reply_parameters=reply_parameters, reply_markup=reply_markup, business_connection_id=business_connection_id, + media_payload=payload) ) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index bc15e9316..1f553deef 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -530,7 +530,7 @@ def send_paid_media( token, chat_id, star_count, media, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, disable_notification=None, protect_content=None, reply_parameters=None, reply_markup=None, - business_connection_id=None): + business_connection_id=None, media_payload=None): method_url = r'sendPaidMedia' media_json, files = convert_input_media_array(media) payload = {'chat_id': chat_id, 'star_count': star_count, 'media': media_json} @@ -552,6 +552,8 @@ def send_paid_media( payload['reply_markup'] = _convert_markup(reply_markup) if business_connection_id: payload['business_connection_id'] = business_connection_id + if media_payload: + payload['payload'] = media_payload return _make_request( token, method_url, params=payload, method='post' if files else 'get', diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index eff7fb931..dd44c2417 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -4627,7 +4627,8 @@ async 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, business_connection_id: Optional[str]=None) -> types.Message: + reply_markup: Optional[REPLY_MARKUP_TYPES]=None, business_connection_id: Optional[str]=None, + payload: Optional[str]=None) -> types.Message: """ Use this method to send paid media to channel chats. On success, the sent Message is returned. @@ -4669,6 +4670,9 @@ async def send_paid_media( :param business_connection_id: Identifier of a business connection, in which the message will be sent :type business_connection_id: :obj:`str` + :param payload: Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. + :type payload: :obj:`str` + :return: On success, the sent Message is returned. :rtype: :class:`telebot.types.Message` """ @@ -4677,7 +4681,8 @@ async 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, business_connection_id=business_connection_id)) + reply_parameters=reply_parameters, reply_markup=reply_markup, business_connection_id=business_connection_id, + media_payload=payload)) async def send_media_group( self, chat_id: Union[int, str], diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index c31bf53da..f4c27d71f 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -520,7 +520,7 @@ async def send_paid_media( token, chat_id, star_count, media, caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, disable_notification=None, protect_content=None, reply_parameters=None, reply_markup=None, - business_connection_id=None): + business_connection_id=None, media_payload=None): method_url = r'sendPaidMedia' media_json, files = convert_input_media_array(media) payload = {'chat_id': chat_id, 'star_count': star_count, 'media': media_json} @@ -542,6 +542,9 @@ async def send_paid_media( payload['reply_markup'] = _convert_markup(reply_markup) if business_connection_id: payload['business_connection_id'] = business_connection_id + if media_payload: + payload['payload'] = media_payload + return await _process_request( token, method_url, params=payload, method='post' if files else 'get',