diff --git a/telebot/__init__.py b/telebot/__init__.py index 6a874ea9e..a79c2ea50 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -3201,7 +3201,7 @@ def send_paid_media( 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, - media_payload=payload) + payload=payload) ) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 1f553deef..c46b108c8 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -530,32 +530,32 @@ 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, media_payload=None): + business_connection_id=None, 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} + _payload = {'chat_id': chat_id, 'star_count': star_count, 'media': media_json} if caption: - payload['caption'] = caption + _payload['caption'] = caption if parse_mode: - payload['parse_mode'] = parse_mode + _payload['parse_mode'] = parse_mode if caption_entities: - payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) + _payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if show_caption_above_media is not None: - payload['show_caption_above_media'] = show_caption_above_media + _payload['show_caption_above_media'] = show_caption_above_media if disable_notification is not None: - payload['disable_notification'] = disable_notification + _payload['disable_notification'] = disable_notification if protect_content is not None: - payload['protect_content'] = protect_content + _payload['protect_content'] = protect_content if reply_parameters is not None: - payload['reply_parameters'] = reply_parameters.to_json() + _payload['reply_parameters'] = reply_parameters.to_json() if reply_markup: - payload['reply_markup'] = _convert_markup(reply_markup) + _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 + _payload['business_connection_id'] = business_connection_id + if payload: + _payload['payload'] = payload return _make_request( - token, method_url, params=payload, + token, method_url, params=_payload, method='post' if files else 'get', files=files if files else None) diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index dd44c2417..ef35d109a 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -4682,7 +4682,7 @@ async def send_paid_media( 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, - media_payload=payload)) + 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 f4c27d71f..0bd447f18 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -520,33 +520,34 @@ 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, media_payload=None): + business_connection_id=None, 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} + _payload = {'chat_id': chat_id, 'star_count': star_count, 'media': media_json} + # USE _payload for request payload if caption: - payload['caption'] = caption + _payload['caption'] = caption if parse_mode: - payload['parse_mode'] = parse_mode + _payload['parse_mode'] = parse_mode if caption_entities: - payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) + _payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities)) if show_caption_above_media is not None: - payload['show_caption_above_media'] = show_caption_above_media + _payload['show_caption_above_media'] = show_caption_above_media if disable_notification is not None: - payload['disable_notification'] = disable_notification + _payload['disable_notification'] = disable_notification if protect_content is not None: - payload['protect_content'] = protect_content + _payload['protect_content'] = protect_content if reply_parameters is not None: - payload['reply_parameters'] = reply_parameters.to_json() + _payload['reply_parameters'] = reply_parameters.to_json() if reply_markup: - payload['reply_markup'] = _convert_markup(reply_markup) + _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 + _payload['business_connection_id'] = business_connection_id + if payload: + _payload['payload'] = payload return await _process_request( - token, method_url, params=payload, + token, method_url, params=_payload, method='post' if files else 'get', files=files if files else None) diff --git a/telebot/types.py b/telebot/types.py index 0aa302012..043473aee 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -9502,8 +9502,8 @@ def de_json(cls, json_string): def __init__(self, source, giveaway_message_id, user=None, is_unclaimed=None, prize_star_count=None, **kwargs): self.source: str = source self.giveaway_message_id: int = giveaway_message_id - self.user: User = user - self.is_unclaimed: bool = is_unclaimed + self.user: Optional[User] = user + self.is_unclaimed: Optional[bool] = is_unclaimed self.prize_star_count: Optional[int] = prize_star_count diff --git a/telebot/util.py b/telebot/util.py index 0448893e1..bed0e8c19 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -48,7 +48,7 @@ "message", "edited_message", "channel_post", "edited_channel_post", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_member", "chat_join_request", "message_reaction", "message_reaction_count", "chat_boost", "removed_chat_boost", - "business_connection", "business_message", "edited_business_message", "deleted_business_messages" + "business_connection", "business_message", "edited_business_message", "deleted_business_messages", "purchased_paid_media" ]