diff --git a/README.md b/README.md
index 73880b554..770186d5c 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
A simple, but extensible Python implementation for the Telegram Bot API.
Both synchronous and asynchronous.
-## Supported Bot API version: 7.3!
+##
Supported Bot API version: 7.4!
diff --git a/telebot/__init__.py b/telebot/__init__.py
index 2d327ab5a..99c492954 100644
--- a/telebot/__init__.py
+++ b/telebot/__init__.py
@@ -1649,7 +1649,8 @@ def send_message(
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
link_preview_options : Optional[types.LinkPreviewOptions]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send text messages.
@@ -1705,6 +1706,9 @@ def send_message(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -1752,7 +1756,8 @@ def send_message(
self.token, chat_id, text,
reply_markup=reply_markup, parse_mode=parse_mode, disable_notification=disable_notification,
timeout=timeout, entities=entities, protect_content=protect_content, message_thread_id=message_thread_id,
- reply_parameters=reply_parameters, link_preview_options=link_preview_options, business_connection_id=business_connection_id))
+ reply_parameters=reply_parameters, link_preview_options=link_preview_options, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id))
def forward_message(
@@ -1813,7 +1818,8 @@ def copy_message(
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
message_thread_id: Optional[int]=None,
- reply_parameters: Optional[types.ReplyParameters]=None) -> types.MessageID:
+ reply_parameters: Optional[types.ReplyParameters]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.MessageID:
"""
Use this method to copy messages of any kind.
@@ -1824,6 +1830,7 @@ def copy_message(
:param from_chat_id: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
:type from_chat_id: :obj:`int` or :obj:`str`
+
:param message_id: Message identifier in the chat specified in from_chat_id
:type message_id: :obj:`int`
@@ -1861,10 +1868,15 @@ def copy_message(
:param reply_parameters: Additional parameters for replies to messages
:type reply_parameters: :class:`telebot.types.ReplyParameters`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
:return: On success, the MessageId of the sent message is returned.
:rtype: :class:`telebot.types.MessageID`
+
"""
+
disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
protect_content = self.protect_content if (protect_content is None) else protect_content
@@ -1891,7 +1903,7 @@ def copy_message(
apihelper.copy_message(self.token, chat_id, from_chat_id, message_id, caption=caption,
parse_mode=parse_mode, caption_entities=caption_entities, disable_notification=disable_notification,
reply_markup=reply_markup, timeout=timeout, protect_content=protect_content,
- message_thread_id=message_thread_id, reply_parameters=reply_parameters))
+ message_thread_id=message_thread_id, reply_parameters=reply_parameters, show_caption_above_media=show_caption_above_media))
def delete_message(self, chat_id: Union[int, str], message_id: int,
@@ -2040,7 +2052,8 @@ def send_dice(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
@@ -2082,6 +2095,9 @@ def send_dice(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2110,7 +2126,8 @@ def send_dice(
apihelper.send_dice(
self.token, chat_id, emoji=emoji, disable_notification=disable_notification,
reply_markup=reply_markup, timeout=timeout, protect_content=protect_content,
- message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id))
+ message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id))
@@ -2127,7 +2144,9 @@ def send_photo(
message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.Message:
"""
Use this method to send photos. On success, the sent Message is returned.
@@ -2181,6 +2200,12 @@ def send_photo(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
@@ -2212,7 +2237,8 @@ def send_photo(
self.token, chat_id, photo, caption=caption, reply_markup=reply_markup,
parse_mode=parse_mode, disable_notification=disable_notification, timeout=timeout,
caption_entities=caption_entities, protect_content=protect_content,
- message_thread_id=message_thread_id, has_spoiler=has_spoiler, reply_parameters=reply_parameters, business_connection_id=business_connection_id))
+ message_thread_id=message_thread_id, has_spoiler=has_spoiler, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id, show_caption_above_media=show_caption_above_media))
@@ -2232,7 +2258,8 @@ def send_audio(
message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send audio files, if you want Telegram clients to display them in the music player.
Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size,
@@ -2305,6 +2332,9 @@ def send_audio(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2339,8 +2369,8 @@ def send_audio(
self.token, chat_id, audio, caption=caption, duration=duration, performer=performer, title=title,
reply_markup=reply_markup, parse_mode=parse_mode, disable_notification=disable_notification,
timeout=timeout, thumbnail=thumbnail, caption_entities=caption_entities, protect_content=protect_content,
- message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
- )
+ message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id))
def send_voice(
@@ -2356,7 +2386,8 @@ def send_voice(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
@@ -2410,6 +2441,9 @@ def send_voice(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@@ -2439,7 +2473,8 @@ def send_voice(
self.token, chat_id, voice, caption=caption, duration=duration, reply_markup=reply_markup,
parse_mode=parse_mode, disable_notification=disable_notification, timeout=timeout,
caption_entities=caption_entities, protect_content=protect_content,
- message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id)
)
@@ -2460,7 +2495,8 @@ def send_document(
protect_content: Optional[bool]=None, message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send general files.
@@ -2526,6 +2562,9 @@ def send_document(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2565,7 +2604,8 @@ def send_document(
reply_markup=reply_markup, parse_mode=parse_mode, disable_notification=disable_notification,
timeout=timeout, caption=caption, thumbnail=thumbnail, caption_entities=caption_entities,
disable_content_type_detection=disable_content_type_detection, visible_file_name=visible_file_name,
- protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters,
+ business_connection_id=business_connection_id, message_effect_id=message_effect_id)
)
@@ -2582,7 +2622,8 @@ def send_sticker(
message_thread_id: Optional[int]=None,
emoji: Optional[str]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
On success, the sent Message is returned.
@@ -2631,6 +2672,9 @@ def send_sticker(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2664,7 +2708,8 @@ def send_sticker(
self.token, chat_id, sticker, 'sticker',
reply_markup=reply_markup, disable_notification=disable_notification, timeout=timeout,
protect_content=protect_content, message_thread_id=message_thread_id, emoji=emoji,
- reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id)
)
@@ -2689,7 +2734,9 @@ def send_video(
has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.Message:
"""
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
@@ -2763,6 +2810,12 @@ def send_video(
:param business_connection_id: Identifier of a business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Identifier of a message effect
+ :type message_effect_id: :obj:`str`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2803,7 +2856,8 @@ def send_video(
supports_streaming=supports_streaming, disable_notification=disable_notification, timeout=timeout,
thumbnail=thumbnail, height=height, width=width, caption_entities=caption_entities,
protect_content=protect_content, message_thread_id=message_thread_id, has_spoiler=has_spoiler,
- reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ reply_parameters=reply_parameters, business_connection_id=business_connection_id, message_effect_id=message_effect_id,
+ show_caption_above_media=show_caption_above_media)
)
@@ -2826,7 +2880,9 @@ def send_animation(
has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.Message:
"""
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
@@ -2899,6 +2955,12 @@ def send_animation(
:param business_connection_id: Identifier of a business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2934,7 +2996,8 @@ def send_animation(
parse_mode=parse_mode, disable_notification=disable_notification, timeout=timeout,
thumbnail=thumbnail, caption_entities=caption_entities, protect_content=protect_content,
width=width, height=height, message_thread_id=message_thread_id, reply_parameters=reply_parameters,
- has_spoiler=has_spoiler, business_connection_id=business_connection_id)
+ has_spoiler=has_spoiler, business_connection_id=business_connection_id, message_effect_id=message_effect_id,
+ show_caption_above_media=show_caption_above_media)
)
@@ -2952,7 +3015,8 @@ def send_video_note(
message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
Use this method to send video messages. On success, the sent Message is returned.
@@ -3010,6 +3074,9 @@ def send_video_note(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3042,7 +3109,8 @@ def send_video_note(
apihelper.send_video_note(
self.token, chat_id, data, duration=duration, length=length, reply_markup=reply_markup,
disable_notification=disable_notification, timeout=timeout, thumbnail=thumbnail,
- protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters,
+ business_connection_id=business_connection_id, message_effect_id=message_effect_id)
)
@@ -3058,7 +3126,8 @@ def send_media_group(
allow_sending_without_reply: Optional[bool]=None, # deprecated, for backward compatibility
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> List[types.Message]:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> List[types.Message]:
"""
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files
can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.
@@ -3095,6 +3164,9 @@ def send_media_group(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, an array of Messages that were sent is returned.
:rtype: List[types.Message]
"""
@@ -3128,7 +3200,7 @@ def send_media_group(
result = apihelper.send_media_group(
self.token, chat_id, media, disable_notification=disable_notification, timeout=timeout,
protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters,
- business_connection_id=business_connection_id)
+ business_connection_id=business_connection_id, message_effect_id=message_effect_id)
return [types.Message.de_json(msg) for msg in result]
@@ -3147,7 +3219,8 @@ def send_location(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send point on the map. On success, the sent Message is returned.
@@ -3203,6 +3276,9 @@ def send_location(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :parameter message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3232,7 +3308,8 @@ def send_location(
self.token, chat_id, latitude, longitude, live_period=live_period, reply_markup=reply_markup,
disable_notification=disable_notification, timeout=timeout, horizontal_accuracy=horizontal_accuracy,
heading=heading, proximity_alert_radius=proximity_alert_radius, protect_content=protect_content,
- message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id)
)
@@ -3354,7 +3431,8 @@ def send_venue(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send information about a venue. On success, the sent Message is returned.
@@ -3417,6 +3495,9 @@ def send_venue(
:param business_connection_id: Identifier of a business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3446,7 +3527,8 @@ def send_venue(
self.token, chat_id, latitude, longitude, title, address, foursquare_id=foursquare_id,
foursquare_type=foursquare_type, disable_notification=disable_notification, reply_markup=reply_markup,
timeout=timeout, google_place_id=google_place_id, google_place_type=google_place_type,
- protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id)
)
@@ -3461,7 +3543,8 @@ def send_contact(
allow_sending_without_reply: Optional[bool]=None, # deprecated, for backward compatibility
protect_content: Optional[bool]=None, message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send phone contacts. On success, the sent Message is returned.
@@ -3511,6 +3594,9 @@ def send_contact(
:param business_connection_id: Identifier of a business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect to be added to the message; for private chats only
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3539,7 +3625,8 @@ def send_contact(
apihelper.send_contact(
self.token, chat_id, phone_number, first_name, last_name=last_name, vcard=vcard,
disable_notification=disable_notification, reply_markup=reply_markup, timeout=timeout,
- protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters,
+ business_connection_id=business_connection_id, message_effect_id=message_effect_id)
)
@@ -4707,7 +4794,8 @@ def send_game(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Used to send the game.
@@ -4746,6 +4834,9 @@ def send_game(
:param business_connection_id: Unique identifier of the business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
@@ -4777,7 +4868,8 @@ def send_game(
apihelper.send_game(
self.token, chat_id, game_short_name, disable_notification=disable_notification,
reply_markup=reply_markup, timeout=timeout, protect_content=protect_content,
- message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id)
+ message_thread_id=message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id,
+ message_effect_id=message_effect_id)
)
@@ -4862,7 +4954,7 @@ def get_game_high_scores(
def send_invoice(
self, chat_id: Union[int, str], title: str, description: str,
- invoice_payload: str, provider_token: str, currency: str,
+ invoice_payload: str, provider_token: Union[str, None], currency: str,
prices: List[types.LabeledPrice], start_parameter: Optional[str]=None,
photo_url: Optional[str]=None, photo_size: Optional[int]=None,
photo_width: Optional[int]=None, photo_height: Optional[int]=None,
@@ -4881,7 +4973,8 @@ def send_invoice(
suggested_tip_amounts: Optional[List[int]]=None,
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
- reply_parameters: Optional[types.ReplyParameters]=None) -> types.Message:
+ reply_parameters: Optional[types.ReplyParameters]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Sends invoice.
@@ -4900,7 +4993,8 @@ def send_invoice(
use for your internal processes.
:type invoice_payload: :obj:`str`
- :param provider_token: Payments provider token, obtained via @Botfather
+ :param provider_token: Payments provider token, obtained via @Botfather; Pass None to omit the parameter
+ to use "XTR" currency
:type provider_token: :obj:`str`
:param currency: Three-letter ISO 4217 currency code,
@@ -4986,6 +5080,9 @@ def send_invoice(
:param reply_parameters: Required if the message is a reply. Additional interface options.
:type reply_parameters: :obj:`types.ReplyParameters`
+ :param message_effect_id: The identifier of a message effect, which will be applied to the sent message
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
@@ -5024,11 +5121,12 @@ def send_invoice(
disable_notification=disable_notification, reply_markup=reply_markup,
provider_data=provider_data, timeout=timeout, protect_content=protect_content,
message_thread_id=message_thread_id, reply_parameters=reply_parameters,
- max_tip_amount=max_tip_amount, suggested_tip_amounts=suggested_tip_amounts)
+ max_tip_amount=max_tip_amount, suggested_tip_amounts=suggested_tip_amounts,
+ message_effect_id=message_effect_id)
)
def create_invoice_link(self,
- title: str, description: str, payload:str, provider_token: str,
+ title: str, description: str, payload:str, provider_token: Union[str, None],
currency: str, prices: List[types.LabeledPrice],
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[List[int]]=None,
@@ -5062,7 +5160,8 @@ def create_invoice_link(self,
use for your internal processes.
:type payload: :obj:`str`
- :param provider_token: Payments provider token, obtained via @Botfather
+ :param provider_token: Payments provider token, obtained via @Botfather; Pass None to omit the parameter
+ to use "XTR" currency
:type provider_token: :obj:`str`
:param currency: Three-letter ISO 4217 currency code,
@@ -5155,7 +5254,7 @@ def send_poll(
business_connection_id: Optional[str]=None,
question_parse_mode: Optional[str] = None,
question_entities: Optional[List[types.MessageEntity]] = None,
- ) -> types.Message:
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send a native poll.
On success, the sent Message is returned.
@@ -5234,6 +5333,9 @@ def send_poll(
:param question_entities: A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
:type question_entities: :obj:`list` of :obj:`MessageEntity`
+ :param message_effect_id: Unique identifier of the message effect to apply to the sent message
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
@@ -5288,7 +5390,8 @@ def send_poll(
reply_markup=reply_markup, timeout=timeout, explanation_entities=explanation_entities,
protect_content=protect_content, message_thread_id=message_thread_id,
reply_parameters=reply_parameters, business_connection_id=business_connection_id,
- question_parse_mode=question_parse_mode, question_entities=question_entities)
+ question_parse_mode=question_parse_mode, question_entities=question_entities,
+ message_effect_id=message_effect_id)
)
@@ -5375,7 +5478,23 @@ def answer_pre_checkout_query(
"""
return apihelper.answer_pre_checkout_query(
self.token, pre_checkout_query_id, ok, error_message=error_message)
+
+ def refund_star_payment(self, user_id: int, telegram_payment_charge_id: str) -> bool:
+ """
+ Refunds a successful payment in Telegram Stars. Returns True on success.
+ Telegram documentation: https://core.telegram.org/bots/api#refundstarpayment
+
+ :param user_id: Identifier of the user whose payment will be refunded
+ :type user_id: :obj:`int`
+
+ :param telegram_payment_charge_id: Telegram payment identifier
+ :type telegram_payment_charge_id: :obj:`str`
+
+ :return: On success, True is returned.
+ :rtype: :obj:`bool`
+ """
+ return apihelper.refund_star_payment(self.token, user_id, telegram_payment_charge_id)
def edit_message_caption(
self, caption: str, chat_id: Optional[Union[int, str]]=None,
@@ -5383,7 +5502,8 @@ def edit_message_caption(
inline_message_id: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
- reply_markup: Optional[types.InlineKeyboardMarkup]=None) -> Union[types.Message, bool]:
+ reply_markup: Optional[types.InlineKeyboardMarkup]=None,
+ show_caption_above_media: Optional[bool]=None) -> Union[types.Message, bool]:
"""
Use this method to edit captions of messages.
@@ -5410,6 +5530,9 @@ def edit_message_caption(
:param reply_markup: A JSON-serialized object for an inline keyboard.
:type reply_markup: :obj:`InlineKeyboardMarkup`
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
+
:return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
:rtype: :obj:`types.Message` | :obj:`bool`
"""
@@ -5417,7 +5540,7 @@ def edit_message_caption(
result = apihelper.edit_message_caption(
self.token, caption, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
- parse_mode=parse_mode, caption_entities=caption_entities, reply_markup=reply_markup)
+ parse_mode=parse_mode, caption_entities=caption_entities, reply_markup=reply_markup, show_caption_above_media=show_caption_above_media)
if type(result) == bool:
return result
diff --git a/telebot/apihelper.py b/telebot/apihelper.py
index 82a1e31e6..4d984dcf1 100644
--- a/telebot/apihelper.py
+++ b/telebot/apihelper.py
@@ -245,7 +245,7 @@ def send_message(
parse_mode=None, disable_notification=None, timeout=None,
entities=None, protect_content=None,
message_thread_id=None, reply_parameters=None, link_preview_options=None,
- business_connection_id=None):
+ business_connection_id=None, message_effect_id=None):
method_url = r'sendMessage'
payload = {'chat_id': str(chat_id), 'text': text}
if link_preview_options is not None:
@@ -268,6 +268,8 @@ def send_message(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload, method='post')
@@ -454,7 +456,7 @@ def send_dice(
token, chat_id,
emoji=None, disable_notification=None,
reply_markup=None, timeout=None, protect_content=None, message_thread_id=None, reply_parameters=None,
- business_connection_id=None):
+ business_connection_id=None, message_effect_id=None):
method_url = r'sendDice'
payload = {'chat_id': chat_id}
if emoji:
@@ -473,6 +475,8 @@ def send_dice(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload)
@@ -481,7 +485,8 @@ def send_photo(
caption=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None,
caption_entities=None, protect_content=None,
- message_thread_id=None, has_spoiler=None, reply_parameters=None, business_connection_id=None):
+ message_thread_id=None, has_spoiler=None, reply_parameters=None, business_connection_id=None, message_effect_id=None,
+ show_caption_above_media=None):
method_url = r'sendPhoto'
payload = {'chat_id': chat_id}
files = None
@@ -513,13 +518,18 @@ def send_photo(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return _make_request(token, method_url, params=payload, files=files, method='post')
def send_media_group(
token, chat_id, media,
disable_notification=None,
- timeout=None, protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ timeout=None, protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendMediaGroup'
media_json, files = convert_input_media_array(media)
payload = {'chat_id': chat_id, 'media': media_json}
@@ -535,6 +545,8 @@ def send_media_group(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(
token, method_url, params=payload,
method='post' if files else 'get',
@@ -547,7 +559,8 @@ def send_location(
reply_markup=None, disable_notification=None,
timeout=None, horizontal_accuracy=None, heading=None,
proximity_alert_radius=None, protect_content=None,
- message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ message_thread_id=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendLocation'
payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude}
if live_period:
@@ -572,6 +585,8 @@ def send_location(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload)
@@ -623,7 +638,8 @@ def send_venue(
token, chat_id, latitude, longitude, title, address,
foursquare_id=None, foursquare_type=None, disable_notification=None,
reply_markup=None, timeout=None, google_place_id=None,
- google_place_type=None, protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ google_place_type=None, protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendVenue'
payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude, 'title': title, 'address': address}
if foursquare_id:
@@ -648,13 +664,16 @@ def send_venue(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload)
def send_contact(
token, chat_id, phone_number, first_name, last_name=None, vcard=None,
disable_notification=None, reply_markup=None, timeout=None,
- protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendContact'
payload = {'chat_id': chat_id, 'phone_number': phone_number, 'first_name': first_name}
if last_name:
@@ -675,6 +694,8 @@ def send_contact(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload)
@@ -694,7 +715,8 @@ def send_chat_action(token, chat_id, action, timeout=None, message_thread_id=Non
def send_video(token, chat_id, data, duration=None, caption=None, reply_markup=None,
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None,
thumbnail=None, width=None, height=None, caption_entities=None, protect_content=None,
- message_thread_id=None, has_spoiler=None, reply_parameters=None, business_connection_id=None):
+ message_thread_id=None, has_spoiler=None, reply_parameters=None, business_connection_id=None, message_effect_id=None,
+ show_caption_above_media=None):
method_url = r'sendVideo'
payload = {'chat_id': chat_id}
files = None
@@ -740,6 +762,10 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_markup=N
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return _make_request(token, method_url, params=payload, files=files, method='post')
@@ -748,7 +774,7 @@ def send_animation(
token, chat_id, data, duration=None, caption=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None,
protect_content=None, width=None, height=None, message_thread_id=None, reply_parameters=None,
- has_spoiler=None, business_connection_id=None):
+ has_spoiler=None, business_connection_id=None, message_effect_id=None, show_caption_above_media=None):
method_url = r'sendAnimation'
payload = {'chat_id': chat_id}
files = None
@@ -792,12 +818,17 @@ def send_animation(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return _make_request(token, method_url, params=payload, files=files, method='post')
def send_voice(token, chat_id, voice, caption=None, duration=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None, caption_entities=None,
- protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendVoice'
payload = {'chat_id': chat_id}
files = None
@@ -827,12 +858,14 @@ def send_voice(token, chat_id, voice, caption=None, duration=None, reply_markup=
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload, files=files, method='post')
def send_video_note(token, chat_id, data, duration=None, length=None, reply_markup=None,
disable_notification=None, timeout=None, thumbnail=None, protect_content=None,
- message_thread_id=None, reply_parameters=None,business_connection_id=None):
+ message_thread_id=None, reply_parameters=None,business_connection_id=None, message_effect_id=None):
method_url = r'sendVideoNote'
payload = {'chat_id': chat_id}
files = None
@@ -868,12 +901,15 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_mark
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload, files=files, method='post')
def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None,
reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumbnail=None,
- caption_entities=None, protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ caption_entities=None, protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendAudio'
payload = {'chat_id': chat_id}
files = None
@@ -915,13 +951,16 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload, files=files, method='post')
def send_data(token, chat_id, data, data_type, reply_markup=None, parse_mode=None,
disable_notification=None, timeout=None, caption=None, thumbnail=None, caption_entities=None,
disable_content_type_detection=None, visible_file_name=None,
- protect_content = None, message_thread_id=None, emoji=None, reply_parameters=None, business_connection_id=None):
+ protect_content = None, message_thread_id=None, emoji=None, reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = get_method_by_type(data_type)
payload = {'chat_id': chat_id}
files = None
@@ -964,6 +1003,8 @@ def send_data(token, chat_id, data, data_type, reply_markup=None, parse_mode=Non
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload, files=files, method='post')
@@ -1357,7 +1398,7 @@ def edit_message_text(token, text, chat_id=None, message_id=None, inline_message
def edit_message_caption(token, caption, chat_id=None, message_id=None, inline_message_id=None,
- parse_mode=None, caption_entities=None,reply_markup=None):
+ parse_mode=None, caption_entities=None,reply_markup=None, show_caption_above_media=None):
method_url = r'editMessageCaption'
payload = {'caption': caption}
if chat_id:
@@ -1372,6 +1413,8 @@ def edit_message_caption(token, caption, chat_id=None, message_id=None, inline_m
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup)
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return _make_request(token, method_url, params=payload, method='post')
@@ -1417,7 +1460,7 @@ def delete_message(token, chat_id, message_id, timeout=None):
def send_game(
token, chat_id, game_short_name,
disable_notification=None, reply_markup=None, timeout=None,
- protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None):
+ protect_content=None, message_thread_id=None, reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = r'sendGame'
payload = {'chat_id': chat_id, 'game_short_name': game_short_name}
if disable_notification is not None:
@@ -1434,6 +1477,8 @@ def send_game(
payload['reply_parameters'] = reply_parameters.to_json()
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload)
@@ -1499,7 +1544,7 @@ def send_invoice(
send_phone_number_to_provider = None, send_email_to_provider = None, is_flexible=None,
disable_notification=None, reply_markup=None, provider_data=None,
timeout=None, max_tip_amount=None, suggested_tip_amounts=None,
- protect_content=None, message_thread_id=None, reply_parameters=None):
+ protect_content=None, message_thread_id=None, reply_parameters=None, message_effect_id=None):
"""
Use this method to send invoices. On success, the sent Message is returned.
:param token: Bot's token (you don't need to fill this)
@@ -1535,7 +1580,7 @@ def send_invoice(
"""
method_url = r'sendInvoice'
payload = {'chat_id': chat_id, 'title': title, 'description': description, 'payload': invoice_payload,
- 'provider_token': provider_token, 'currency': currency,
+ 'currency': currency,
'prices': _convert_list_json_serializable(prices)}
if start_parameter:
payload['start_parameter'] = start_parameter
@@ -1579,6 +1624,10 @@ def send_invoice(
payload['message_thread_id'] = message_thread_id
if reply_parameters is not None:
payload['reply_parameters'] = reply_parameters.to_json()
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if provider_token is not None:
+ payload['provider_token'] = provider_token
return _make_request(token, method_url, params=payload)
@@ -1616,11 +1665,16 @@ def answer_pre_checkout_query(token, pre_checkout_query_id, ok, error_message=No
payload['error_message'] = error_message
return _make_request(token, method_url, params=payload)
+def refund_star_payment(token, user_id, telegram_payment_charge_id):
+ method_url = 'refundStarPayment'
+ payload = {'user_id': user_id, 'telegram_payment_charge_id': telegram_payment_charge_id}
+ return _make_request(token, method_url, params=payload)
+
def unpin_all_general_forum_topic_messages(token, chat_id):
method_url = 'unpinAllGeneralForumTopicMessages'
payload = {'chat_id': chat_id}
- return _make_request(token, method_url, params=payload, method='post')
+ return _make_request(token, method_url, params=payload)
# InlineQuery
@@ -1783,7 +1837,7 @@ def create_invoice_link(token, title, description, payload, provider_token,
need_email=None, need_shipping_address=None, send_phone_number_to_provider=None,
send_email_to_provider=None, is_flexible=None):
method_url = r'createInvoiceLink'
- payload = {'title': title, 'description': description, 'payload': payload, 'provider_token': provider_token,
+ payload = {'title': title, 'description': description, 'payload': payload,
'currency': currency, 'prices': _convert_list_json_serializable(prices)}
if max_tip_amount:
payload['max_tip_amount'] = max_tip_amount
@@ -1813,6 +1867,8 @@ def create_invoice_link(token, title, description, payload, provider_token,
payload['send_email_to_provider'] = send_email_to_provider
if is_flexible is not None:
payload['is_flexible'] = is_flexible
+ if provider_token is not None:
+ payload['provider_token'] = provider_token
return _make_request(token, method_url, params=payload, method='post')
@@ -1822,7 +1878,7 @@ def send_poll(
is_anonymous = None, type = None, allows_multiple_answers = None, correct_option_id = None, explanation = None,
explanation_parse_mode=None, open_period = None, close_date = None, is_closed = None, disable_notification=False,
reply_markup=None, timeout=None, explanation_entities=None, protect_content=None, message_thread_id=None,
- reply_parameters=None, business_connection_id=None, question_parse_mode=None, question_entities=None):
+ reply_parameters=None, business_connection_id=None, question_parse_mode=None, question_entities=None, message_effect_id=None):
method_url = r'sendPoll'
payload = {
'chat_id': str(chat_id),
@@ -1871,6 +1927,8 @@ def send_poll(
payload['question_parse_mode'] = question_parse_mode
if question_entities:
payload['question_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(question_entities))
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return _make_request(token, method_url, params=payload)
def create_forum_topic(token, chat_id, name, icon_color=None, icon_custom_emoji_id=None):
@@ -1972,7 +2030,7 @@ def forward_messages(token, chat_id, from_chat_id, message_ids, disable_notifica
return _make_request(token, method_url, params=payload)
def copy_messages(token, chat_id, from_chat_id, message_ids, disable_notification=None,
- message_thread_id=None, protect_content=None, remove_caption=None):
+ message_thread_id=None, protect_content=None, remove_caption=None, show_caption_above_media=None):
method_url = 'copyMessages'
payload = {
'chat_id': chat_id,
@@ -1987,6 +2045,8 @@ def copy_messages(token, chat_id, from_chat_id, message_ids, disable_notificatio
payload['protect_content'] = protect_content
if remove_caption is not None:
payload['remove_caption'] = remove_caption
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return _make_request(token, method_url, params=payload)
diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py
index 992625641..be3135739 100644
--- a/telebot/async_telebot.py
+++ b/telebot/async_telebot.py
@@ -3061,7 +3061,8 @@ async def send_message(
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
link_preview_options: Optional[types.LinkPreviewOptions]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send text messages.
@@ -3117,6 +3118,9 @@ async def send_message(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3171,7 +3175,8 @@ async def send_message(
await asyncio_helper.send_message(
self.token, chat_id, text,
reply_markup, parse_mode, disable_notification, timeout,
- entities, protect_content, message_thread_id, reply_parameters, link_preview_options, business_connection_id))
+ entities, protect_content, message_thread_id, reply_parameters, link_preview_options, business_connection_id,
+ message_effect_id=message_effect_id))
async def forward_message(
self, chat_id: Union[int, str], from_chat_id: Union[int, str],
@@ -3229,7 +3234,8 @@ async def copy_message(
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
message_thread_id: Optional[int]=None,
- reply_parameters: Optional[types.ReplyParameters]=None) -> types.MessageID:
+ reply_parameters: Optional[types.ReplyParameters]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.MessageID:
"""
Use this method to copy messages of any kind.
@@ -3277,6 +3283,9 @@ async def copy_message(
:param reply_parameters: Reply parameters.
:type reply_parameters: :class:`telebot.types.ReplyParameters`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
:return: On success, the MessageId of the sent message is returned.
:rtype: :class:`telebot.types.MessageID`
@@ -3308,7 +3317,7 @@ async def copy_message(
return types.MessageID.de_json(
await asyncio_helper.copy_message(self.token, chat_id, from_chat_id, message_id, caption, parse_mode, caption_entities,
disable_notification, reply_markup,
- timeout, protect_content, message_thread_id, reply_parameters))
+ timeout, protect_content, message_thread_id, reply_parameters, show_caption_above_media=show_caption_above_media))
async def delete_message(self, chat_id: Union[int, str], message_id: int,
timeout: Optional[int]=None) -> bool:
@@ -3445,7 +3454,8 @@ async def send_dice(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
@@ -3487,6 +3497,9 @@ async def send_dice(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3517,7 +3530,7 @@ async def send_dice(
return types.Message.de_json(
await asyncio_helper.send_dice(
self.token, chat_id, emoji, disable_notification,
- reply_markup, timeout, protect_content, message_thread_id, reply_parameters, business_connection_id))
+ reply_markup, timeout, protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def send_photo(
@@ -3533,7 +3546,9 @@ async def send_photo(
message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.Message:
"""
Use this method to send photos. On success, the sent Message is returned.
@@ -3587,6 +3602,12 @@ async def send_photo(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
@@ -3620,7 +3641,8 @@ async def send_photo(
await asyncio_helper.send_photo(
self.token, chat_id, photo, caption, reply_markup,
parse_mode, disable_notification, timeout, caption_entities,
- protect_content, message_thread_id, has_spoiler, reply_parameters, business_connection_id))
+ protect_content, message_thread_id, has_spoiler, reply_parameters, business_connection_id, message_effect_id=message_effect_id,
+ show_caption_above_media=show_caption_above_media))
async def send_audio(
self, chat_id: Union[int, str], audio: Union[Any, str],
@@ -3638,7 +3660,8 @@ async def send_audio(
message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send audio files, if you want Telegram clients to display them in the music player.
Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size,
@@ -3711,6 +3734,9 @@ async def send_audio(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3747,7 +3773,7 @@ async def send_audio(
await asyncio_helper.send_audio(
self.token, chat_id, audio, caption, duration, performer, title,
reply_markup, parse_mode, disable_notification, timeout, thumbnail,
- caption_entities, protect_content, message_thread_id, reply_parameters, business_connection_id))
+ caption_entities, protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def send_voice(
self, chat_id: Union[int, str], voice: Union[Any, str],
@@ -3762,7 +3788,8 @@ async def send_voice(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
@@ -3816,6 +3843,9 @@ async def send_voice(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@@ -3847,7 +3877,7 @@ async def send_voice(
await asyncio_helper.send_voice(
self.token, chat_id, voice, caption, duration, reply_markup,
parse_mode, disable_notification, timeout, caption_entities,
- protect_content, message_thread_id, reply_parameters, business_connection_id))
+ protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def send_document(
self, chat_id: Union[int, str], document: Union[Any, str],
@@ -3867,7 +3897,8 @@ async def send_document(
message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send general files.
@@ -3933,6 +3964,9 @@ async def send_document(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -3977,7 +4011,7 @@ async def send_document(
disable_notification = disable_notification, timeout = timeout, caption = caption, thumbnail= thumbnail,
caption_entities = caption_entities,
disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name, protect_content = protect_content,
- message_thread_id = message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id))
+ message_thread_id = message_thread_id, reply_parameters=reply_parameters, business_connection_id=business_connection_id, message_effect_id=message_effect_id))
async def send_sticker(
self, chat_id: Union[int, str], sticker: Union[Any, str],
@@ -3991,7 +4025,8 @@ async def send_sticker(
message_thread_id: Optional[int]=None,
emoji: Optional[str]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
On success, the sent Message is returned.
@@ -4040,6 +4075,9 @@ async def send_sticker(
:param business_connection_id: Unique identifier for the target business connection
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier for the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4078,7 +4116,7 @@ async def send_sticker(
reply_markup=reply_markup,
disable_notification=disable_notification, timeout=timeout,
protect_content=protect_content,
- message_thread_id=message_thread_id, emoji=emoji, reply_parameters=reply_parameters, business_connection_id=business_connection_id))
+ message_thread_id=message_thread_id, emoji=emoji, reply_parameters=reply_parameters, business_connection_id=business_connection_id, message_effect_id=message_effect_id))
async def send_video(
self, chat_id: Union[int, str], video: Union[Any, str],
@@ -4101,7 +4139,9 @@ async def send_video(
has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.Message:
"""
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
@@ -4175,6 +4215,12 @@ async def send_video(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4216,7 +4262,8 @@ async def send_video(
await asyncio_helper.send_video(
self.token, chat_id, video, duration, caption, reply_markup,
parse_mode, supports_streaming, disable_notification, timeout, thumbnail, width, height,
- caption_entities, protect_content, message_thread_id, has_spoiler, reply_parameters, business_connection_id))
+ caption_entities, protect_content, message_thread_id, has_spoiler, reply_parameters, business_connection_id, message_effect_id=message_effect_id,
+ show_caption_above_media=show_caption_above_media))
async def send_animation(
self, chat_id: Union[int, str], animation: Union[Any, str],
@@ -4237,7 +4284,9 @@ async def send_animation(
has_spoiler: Optional[bool]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None,
+ show_caption_above_media: Optional[bool]=None) -> types.Message:
"""
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
@@ -4310,6 +4359,12 @@ async def send_animation(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4346,7 +4401,8 @@ async def send_animation(
await asyncio_helper.send_animation(
self.token, chat_id, animation, duration, caption,
reply_markup, parse_mode, disable_notification, timeout, thumbnail,
- caption_entities, width, height, protect_content, message_thread_id, has_spoiler, reply_parameters, business_connection_id))
+ caption_entities, width, height, protect_content, message_thread_id, has_spoiler, reply_parameters, business_connection_id,
+ message_effect_id=message_effect_id, show_caption_above_media=show_caption_above_media))
async def send_video_note(
self, chat_id: Union[int, str], data: Union[Any, str],
@@ -4362,7 +4418,8 @@ async def send_video_note(
message_thread_id: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
Use this method to send video messages. On success, the sent Message is returned.
@@ -4420,6 +4477,9 @@ async def send_video_note(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4454,7 +4514,7 @@ async def send_video_note(
return types.Message.de_json(
await asyncio_helper.send_video_note(
self.token, chat_id, data, duration, length, reply_markup,
- disable_notification, timeout, thumbnail, protect_content, message_thread_id, reply_parameters, business_connection_id))
+ disable_notification, timeout, thumbnail, protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def send_media_group(
self, chat_id: Union[int, str],
@@ -4468,7 +4528,8 @@ async def send_media_group(
allow_sending_without_reply: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> List[types.Message]:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> List[types.Message]:
"""
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files
can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.
@@ -4505,6 +4566,9 @@ async def send_media_group(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, an array of Messages that were sent is returned.
:rtype: List[types.Message]
"""
@@ -4538,7 +4602,7 @@ async def send_media_group(
reply_parameters.allow_sending_without_reply = self.allow_sending_without_reply
result = await asyncio_helper.send_media_group(
- self.token, chat_id, media, disable_notification, timeout, protect_content, message_thread_id, reply_parameters, business_connection_id)
+ self.token, chat_id, media, disable_notification, timeout, protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id)
return [types.Message.de_json(msg) for msg in result]
async def send_location(
@@ -4556,7 +4620,8 @@ async def send_location(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send point on the map. On success, the sent Message is returned.
@@ -4612,6 +4677,9 @@ async def send_location(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4644,7 +4712,7 @@ async def send_location(
self.token, chat_id, latitude, longitude, live_period,
reply_markup, disable_notification, timeout,
horizontal_accuracy, heading, proximity_alert_radius,
- protect_content, message_thread_id, reply_parameters, business_connection_id))
+ protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def edit_message_live_location(
self, latitude: float, longitude: float,
@@ -4760,7 +4828,8 @@ async def send_venue(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send information about a venue. On success, the sent Message is returned.
@@ -4824,6 +4893,9 @@ async def send_venue(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4855,7 +4927,7 @@ async def send_venue(
await asyncio_helper.send_venue(
self.token, chat_id, latitude, longitude, title, address, foursquare_id, foursquare_type,
disable_notification, reply_markup, timeout,
- google_place_id, google_place_type, protect_content, message_thread_id, reply_parameters, business_connection_id))
+ google_place_id, google_place_type, protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def send_contact(
@@ -4870,7 +4942,8 @@ async def send_contact(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send phone contacts. On success, the sent Message is returned.
@@ -4921,6 +4994,9 @@ async def send_contact(
:param business_connection_id: Identifier of a business connection, in which the message will be sent
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Unique identifier of the message effect
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -4952,7 +5028,7 @@ async def send_contact(
await asyncio_helper.send_contact(
self.token, chat_id, phone_number, first_name, last_name, vcard,
disable_notification, reply_markup, timeout,
- protect_content, message_thread_id, reply_parameters, business_connection_id))
+ protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id))
async def send_chat_action(
@@ -6063,7 +6139,8 @@ async def send_game(
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
reply_parameters: Optional[types.ReplyParameters]=None,
- business_connection_id: Optional[str]=None) -> types.Message:
+ business_connection_id: Optional[str]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Used to send the game.
@@ -6102,6 +6179,9 @@ async def send_game(
:param business_connection_id: Identifier of the business connection.
:type business_connection_id: :obj:`str`
+ :param message_effect_id: Identifier of the message effect.
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
@@ -6132,7 +6212,7 @@ async def send_game(
result = await asyncio_helper.send_game(
self.token, chat_id, game_short_name, disable_notification,
reply_markup, timeout,
- protect_content, message_thread_id, reply_parameters, business_connection_id)
+ protect_content, message_thread_id, reply_parameters, business_connection_id, message_effect_id=message_effect_id)
return types.Message.de_json(result)
async def set_game_score(
@@ -6211,7 +6291,7 @@ async def get_game_high_scores(
async def send_invoice(
self, chat_id: Union[int, str], title: str, description: str,
- invoice_payload: str, provider_token: str, currency: str,
+ invoice_payload: str, provider_token: Union[str, None], currency: str,
prices: List[types.LabeledPrice], start_parameter: Optional[str]=None,
photo_url: Optional[str]=None, photo_size: Optional[int]=None,
photo_width: Optional[int]=None, photo_height: Optional[int]=None,
@@ -6230,7 +6310,8 @@ async def send_invoice(
suggested_tip_amounts: Optional[List[int]]=None,
protect_content: Optional[bool]=None,
message_thread_id: Optional[int]=None,
- reply_parameters: Optional[types.ReplyParameters]=None) -> types.Message:
+ reply_parameters: Optional[types.ReplyParameters]=None,
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Sends invoice.
@@ -6249,7 +6330,8 @@ async def send_invoice(
use for your internal processes.
:type invoice_payload: :obj:`str`
- :param provider_token: Payments provider token, obtained via @Botfather
+ :param provider_token: Payments provider token, obtained via @Botfather; Pass None to omit the parameter
+ to use "XTR" currency
:type provider_token: :obj:`str`
:param currency: Three-letter ISO 4217 currency code,
@@ -6335,6 +6417,9 @@ async def send_invoice(
:param reply_parameters: Reply parameters.
:type reply_parameters: :class:`telebot.types.ReplyParameters`
+ :param message_effect_id: The identifier of a message effect to be applied to the message
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
@@ -6368,12 +6453,13 @@ async def send_invoice(
photo_height, need_name, need_phone_number, need_email, need_shipping_address,
send_phone_number_to_provider, send_email_to_provider, is_flexible, disable_notification,
reply_markup, provider_data, timeout,
- max_tip_amount, suggested_tip_amounts, protect_content, message_thread_id, reply_parameters)
+ max_tip_amount, suggested_tip_amounts, protect_content, message_thread_id, reply_parameters,
+ message_effect_id=message_effect_id)
return types.Message.de_json(result)
async def create_invoice_link(self,
- title: str, description: str, payload:str, provider_token: str,
+ title: str, description: str, payload:str, provider_token: Union[str, None],
currency: str, prices: List[types.LabeledPrice],
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[List[int]]=None,
@@ -6407,7 +6493,8 @@ async def create_invoice_link(self,
use for your internal processes.
:type payload: :obj:`str`
- :param provider_token: Payments provider token, obtained via @Botfather
+ :param provider_token: Payments provider token, obtained via @Botfather; Pass None to omit the parameter
+ to use "XTR" currency
:type provider_token: :obj:`str`
:param currency: Three-letter ISO 4217 currency code,
@@ -6498,7 +6585,7 @@ async def send_poll(
business_connection_id: Optional[str]=None,
question_parse_mode: Optional[str] = None,
question_entities: Optional[List[types.MessageEntity]] = None,
- ) -> types.Message:
+ message_effect_id: Optional[str]=None) -> types.Message:
"""
Use this method to send a native poll.
On success, the sent Message is returned.
@@ -6581,6 +6668,9 @@ async def send_poll(
:param question_entities: A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
:type question_entities: :obj:`list` of :obj:`MessageEntity`
+ :param message_effect_id: Identifier of the message effect to apply to the sent message
+ :type message_effect_id: :obj:`str`
+
:return: On success, the sent Message is returned.
:rtype: :obj:`types.Message`
"""
@@ -6632,7 +6722,8 @@ async def send_poll(
explanation, explanation_parse_mode, open_period, close_date, is_closed,
disable_notification,
reply_markup, timeout, explanation_entities, protect_content, message_thread_id, reply_parameters,
- business_connection_id, question_parse_mode=question_parse_mode, question_entities=question_entities))
+ business_connection_id, question_parse_mode=question_parse_mode, question_entities=question_entities,
+ message_effect_id=message_effect_id))
async def stop_poll(
self, chat_id: Union[int, str], message_id: int,
@@ -6711,6 +6802,23 @@ async def answer_pre_checkout_query(
:rtype: :obj:`bool`
"""
return await asyncio_helper.answer_pre_checkout_query(self.token, pre_checkout_query_id, ok, error_message)
+
+ async def refund_star_payment(self, user_id: int, telegram_payment_charge_id: str) -> bool:
+ """
+ Refunds a successful payment in Telegram Stars. Returns True on success.
+
+ Telegram documentation: https://core.telegram.org/bots/api#refundstarpayment
+
+ :param user_id: Identifier of the user whose payment will be refunded
+ :type user_id: :obj:`int`
+
+ :param telegram_payment_charge_id: Telegram payment identifier
+ :type telegram_payment_charge_id: :obj:`str`
+
+ :return: On success, True is returned.
+ :rtype: :obj:`bool`
+ """
+ return await asyncio_helper.refund_star_payment(self.token, user_id, telegram_payment_charge_id)
async def edit_message_caption(
self, caption: str, chat_id: Optional[Union[int, str]]=None,
@@ -6718,7 +6826,8 @@ async def edit_message_caption(
inline_message_id: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
- reply_markup: Optional[types.InlineKeyboardMarkup]=None) -> Union[types.Message, bool]:
+ reply_markup: Optional[types.InlineKeyboardMarkup]=None,
+ show_caption_above_media: Optional[bool]=None) -> Union[types.Message, bool]:
"""
Use this method to edit captions of messages.
@@ -6745,13 +6854,16 @@ async def edit_message_caption(
:param reply_markup: A JSON-serialized object for an inline keyboard.
:type reply_markup: :obj:`InlineKeyboardMarkup`
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
+ :type show_caption_above_media: :obj:`bool`
+
:return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
:rtype: :obj:`types.Message` | :obj:`bool`
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
result = await asyncio_helper.edit_message_caption(self.token, caption, chat_id, message_id, inline_message_id,
- parse_mode, caption_entities, reply_markup)
+ parse_mode, caption_entities, reply_markup, show_caption_above_media=show_caption_above_media)
if type(result) == bool:
return result
return types.Message.de_json(result)
diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py
index 1a56348cf..e7838fbb4 100644
--- a/telebot/asyncio_helper.py
+++ b/telebot/asyncio_helper.py
@@ -281,7 +281,7 @@ async def send_message(
reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None,
entities=None, protect_content=None,
- message_thread_id=None, reply_parameters=None, link_preview_options=None, business_connection_id=None):
+ message_thread_id=None, reply_parameters=None, link_preview_options=None, business_connection_id=None, message_effect_id=None):
method_name = 'sendMessage'
params = {'chat_id': str(chat_id), 'text': text}
if link_preview_options is not None:
@@ -304,6 +304,8 @@ async def send_message(
params['message_thread_id'] = message_thread_id
if business_connection_id:
params['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ params['message_effect_id'] = message_effect_id
return await _process_request(token, method_name, params=params)
@@ -414,7 +416,7 @@ async def forward_message(
async def copy_message(token, chat_id, from_chat_id, message_id, caption=None, parse_mode=None, caption_entities=None,
disable_notification=None,
- reply_markup=None, timeout=None, protect_content=None, message_thread_id=None, reply_parameters=None):
+ reply_markup=None, timeout=None, protect_content=None, message_thread_id=None, reply_parameters=None, show_caption_above_media=None):
method_url = r'copyMessage'
payload = {'chat_id': chat_id, 'from_chat_id': from_chat_id, 'message_id': message_id}
if caption is not None:
@@ -435,6 +437,8 @@ async def copy_message(token, chat_id, from_chat_id, message_id, caption=None, p
payload['protect_content'] = protect_content
if message_thread_id:
payload['message_thread_id'] = message_thread_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return await _process_request(token, method_url, params=payload)
@@ -442,7 +446,7 @@ async def send_dice(
token, chat_id,
emoji=None, disable_notification=None,
reply_markup=None, timeout=None, protect_content=None,
- message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ message_thread_id=None,reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = r'sendDice'
payload = {'chat_id': chat_id}
if emoji:
@@ -461,6 +465,8 @@ async def send_dice(
payload['reply_parameters'] = json.dumps(reply_parameters.to_dict())
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload)
@@ -470,7 +476,7 @@ async def send_photo(
parse_mode=None, disable_notification=None, timeout=None,
caption_entities=None, protect_content=None,
message_thread_id=None, has_spoiler=None,reply_parameters=None,
- business_connection_id=None):
+ business_connection_id=None, message_effect_id=None, show_caption_above_media=None):
method_url = r'sendPhoto'
payload = {'chat_id': chat_id}
files = None
@@ -502,13 +508,17 @@ async def send_photo(
payload['has_spoiler'] = has_spoiler
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return await _process_request(token, method_url, params=payload, files=files, method='post')
async def send_media_group(
token, chat_id, media,
disable_notification=None,
- timeout=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ timeout=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = r'sendMediaGroup'
media_json, files = await convert_input_media_array(media)
payload = {'chat_id': chat_id, 'media': media_json}
@@ -524,6 +534,8 @@ async def send_media_group(
payload['reply_parameters'] = json.dumps(reply_parameters.to_dict())
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(
token, method_url, params=payload,
method='post' if files else 'get',
@@ -535,7 +547,8 @@ async def send_location(
live_period=None,
reply_markup=None, disable_notification=None,
timeout=None, horizontal_accuracy=None, heading=None,
- proximity_alert_radius=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ proximity_alert_radius=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendLocation'
payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude}
if live_period:
@@ -560,6 +573,8 @@ async def send_location(
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload)
@@ -612,7 +627,8 @@ async def send_venue(
foursquare_id=None, foursquare_type=None, disable_notification=None,
reply_markup=None, timeout=None,
google_place_id=None,
- google_place_type=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ google_place_type=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendVenue'
payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude, 'title': title, 'address': address}
if foursquare_id:
@@ -637,13 +653,15 @@ async def send_venue(
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload)
async def send_contact(
token, chat_id, phone_number, first_name, last_name=None, vcard=None,
disable_notification=None, reply_markup=None, timeout=None,
- protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = r'sendContact'
payload = {'chat_id': chat_id, 'phone_number': phone_number, 'first_name': first_name}
if last_name:
@@ -664,6 +682,8 @@ async def send_contact(
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload)
@@ -682,7 +702,8 @@ async def send_chat_action(token, chat_id, action, timeout=None, message_thread_
async def send_video(token, chat_id, data, duration=None, caption=None, reply_markup=None,
parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None,
thumbnail=None, width=None, height=None, caption_entities=None,
- protect_content=None, message_thread_id=None, has_spoiler=None,reply_parameters=None, business_connection_id=None):
+ protect_content=None, message_thread_id=None, has_spoiler=None,reply_parameters=None, business_connection_id=None,
+ message_effect_id=None, show_caption_above_media=None):
method_url = r'sendVideo'
payload = {'chat_id': chat_id}
files = None
@@ -728,6 +749,10 @@ async def send_video(token, chat_id, data, duration=None, caption=None, reply_m
payload['has_spoiler'] = has_spoiler
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return await _process_request(token, method_url, params=payload, files=files, method='post')
@@ -735,7 +760,7 @@ async def send_animation(
token, chat_id, data, duration=None, caption=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None, thumbnail=None, caption_entities=None,
width=None, height=None, protect_content=None, message_thread_id=None,
- has_spoiler=None,reply_parameters=None, business_connection_id=None):
+ has_spoiler=None,reply_parameters=None, business_connection_id=None, message_effect_id=None, show_caption_above_media=None):
method_url = r'sendAnimation'
payload = {'chat_id': chat_id}
files = None
@@ -779,12 +804,16 @@ async def send_animation(
payload['has_spoiler'] = has_spoiler
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return await _process_request(token, method_url, params=payload, files=files, method='post')
async def send_voice(token, chat_id, voice, caption=None, duration=None, reply_markup=None,
parse_mode=None, disable_notification=None, timeout=None, caption_entities=None,
- protect_content=None, message_thread_id=None,reply_parameters=None,business_connection_id=None):
+ protect_content=None, message_thread_id=None,reply_parameters=None,business_connection_id=None, message_effect_id=None):
method_url = r'sendVoice'
payload = {'chat_id': chat_id}
files = None
@@ -814,12 +843,14 @@ async def send_voice(token, chat_id, voice, caption=None, duration=None, reply_
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload, files=files, method='post')
async def send_video_note(token, chat_id, data, duration=None, length=None, reply_markup=None,
disable_notification=None, timeout=None, thumbnail=None, protect_content=None,
- message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ message_thread_id=None,reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = r'sendVideoNote'
payload = {'chat_id': chat_id}
files = None
@@ -855,12 +886,15 @@ async def send_video_note(token, chat_id, data, duration=None, length=None, rep
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload, files=files, method='post')
async def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None,
reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumbnail=None,
- caption_entities=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ caption_entities=None, protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None,
+ message_effect_id=None):
method_url = r'sendAudio'
payload = {'chat_id': chat_id}
files = None
@@ -902,13 +936,15 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload, files=files, method='post')
async def send_data(token, chat_id, data, data_type, reply_markup=None, parse_mode=None,
disable_notification=None, timeout=None, caption=None, thumbnail=None, caption_entities=None,
disable_content_type_detection=None, visible_file_name=None, protect_content=None,
- message_thread_id=None, emoji=None,reply_parameters=None, business_connection_id=None):
+ message_thread_id=None, emoji=None,reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = await get_method_by_type(data_type)
payload = {'chat_id': chat_id}
files = None
@@ -951,6 +987,8 @@ async def send_data(token, chat_id, data, data_type, reply_markup=None, parse_m
payload['emoji'] = emoji
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload, files=files, method='post')
@@ -1340,7 +1378,7 @@ async def edit_message_text(token, text, chat_id=None, message_id=None, inline_m
async def edit_message_caption(token, caption, chat_id=None, message_id=None, inline_message_id=None,
- parse_mode=None, caption_entities=None,reply_markup=None):
+ parse_mode=None, caption_entities=None,reply_markup=None, show_caption_above_media=None):
method_url = r'editMessageCaption'
payload = {'caption': caption}
if chat_id:
@@ -1355,6 +1393,8 @@ async def edit_message_caption(token, caption, chat_id=None, message_id=None, in
payload['caption_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(caption_entities))
if reply_markup:
payload['reply_markup'] = await _convert_markup(reply_markup)
+ if show_caption_above_media is not None:
+ payload['show_caption_above_media'] = show_caption_above_media
return await _process_request(token, method_url, params=payload, method='post')
@@ -1400,7 +1440,7 @@ async def delete_message(token, chat_id, message_id, timeout=None):
async def send_game(
token, chat_id, game_short_name,
disable_notification=None, reply_markup=None, timeout=None,
- protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None):
+ protect_content=None, message_thread_id=None,reply_parameters=None, business_connection_id=None, message_effect_id=None):
method_url = r'sendGame'
payload = {'chat_id': chat_id, 'game_short_name': game_short_name}
if disable_notification is not None:
@@ -1417,6 +1457,8 @@ async def send_game(
payload['message_thread_id'] = message_thread_id
if business_connection_id:
payload['business_connection_id'] = business_connection_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload)
@@ -1482,7 +1524,7 @@ async def send_invoice(
send_phone_number_to_provider = None, send_email_to_provider = None, is_flexible=None,
disable_notification=None, reply_markup=None, provider_data=None,
timeout=None, max_tip_amount=None, suggested_tip_amounts=None,
- protect_content=None, message_thread_id=None, reply_parameters=None):
+ protect_content=None, message_thread_id=None, reply_parameters=None, message_effect_id=None):
"""
Use this method to send invoices. On success, the sent Message is returned.
:param token: Bot's token (you don't need to fill this)
@@ -1519,8 +1561,8 @@ async def send_invoice(
"""
method_url = r'sendInvoice'
payload = {'chat_id': chat_id, 'title': title, 'description': description, 'payload': invoice_payload,
- 'provider_token': provider_token, 'currency': currency,
- 'prices': await _convert_list_json_serializable(prices)}
+ 'currency': currency,
+ 'prices': await _convert_list_json_serializable(prices)}
if start_parameter:
payload['start_parameter'] = start_parameter
if photo_url:
@@ -1563,6 +1605,10 @@ async def send_invoice(
payload['protect_content'] = protect_content
if message_thread_id:
payload['message_thread_id'] = message_thread_id
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
+ if provider_token is not None:
+ payload['provider_token'] = provider_token
return await _process_request(token, method_url, params=payload)
@@ -1601,10 +1647,16 @@ async def answer_pre_checkout_query(token, pre_checkout_query_id, ok, error_mess
return await _process_request(token, method_url, params=payload)
+async def refund_star_payment(token, user_id, telegram_payment_charge_id):
+ method_url = 'refundStarPayment'
+ payload = {'user_id': user_id, 'telegram_payment_charge_id': telegram_payment_charge_id}
+ return await _process_request(token, method_url, params=payload)
+
+
async def unpin_all_general_forum_topic_messages(token, chat_id):
method_url = 'unpinAllGeneralForumTopicMessages'
payload = {'chat_id': chat_id}
- return await _process_request(token, method_url, params=payload, method='post')
+ return await _process_request(token, method_url, params=payload)
# InlineQuery
@@ -1762,7 +1814,7 @@ async def create_invoice_link(token, title, description, payload, provider_token
need_email=None, need_shipping_address=None, send_phone_number_to_provider=None,
send_email_to_provider=None, is_flexible=None):
method_url = r'createInvoiceLink'
- payload = {'title': title, 'description': description, 'payload': payload, 'provider_token': provider_token,
+ payload = {'title': title, 'description': description, 'payload': payload,
'currency': currency, 'prices': await _convert_list_json_serializable(prices)}
if max_tip_amount:
payload['max_tip_amount'] = max_tip_amount
@@ -1792,6 +1844,8 @@ async def create_invoice_link(token, title, description, payload, provider_token
payload['send_email_to_provider'] = send_email_to_provider
if is_flexible is not None:
payload['is_flexible'] = is_flexible
+ if provider_token is not None:
+ payload['provider_token'] = provider_token
return await _process_request(token, method_url, params=payload, method='post')
@@ -1803,7 +1857,7 @@ async def send_poll(
explanation = None, explanation_parse_mode=None, open_period = None, close_date = None, is_closed = None,
disable_notification=False,
reply_markup=None, timeout=None, explanation_entities=None, protect_content=None, message_thread_id=None,
- reply_parameters=None,business_connection_id=None, question_parse_mode=None, question_entities=None):
+ reply_parameters=None,business_connection_id=None, question_parse_mode=None, question_entities=None, message_effect_id=None):
method_url = r'sendPoll'
payload = {
'chat_id': str(chat_id),
@@ -1853,6 +1907,8 @@ async def send_poll(
payload['question_parse_mode'] = question_parse_mode
if question_entities:
payload['question_entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(question_entities))
+ if message_effect_id:
+ payload['message_effect_id'] = message_effect_id
return await _process_request(token, method_url, params=payload)
diff --git a/telebot/formatting.py b/telebot/formatting.py
index dd7309416..09687ec9f 100644
--- a/telebot/formatting.py
+++ b/telebot/formatting.py
@@ -397,6 +397,8 @@ def apply_html_entities(text: str, entities: Optional[List], custom_subs: Option
"spoiler": "{text}",
"custom_emoji": "{text}",
"blockquote": "{text}
",
+ "expandable_blockquote": "{text}
",
+
}
if custom_subs:
diff --git a/telebot/types.py b/telebot/types.py
index 1438cf762..1a0b1efec 100644
--- a/telebot/types.py
+++ b/telebot/types.py
@@ -951,6 +951,9 @@ class Message(JsonDeserializable):
if it is a text message and link preview options were changed
:type link_preview_options: :class:`telebot.types.LinkPreviewOptions`
+ :param effect_id: Optional. Unique identifier of the message effect added to the message
+ :type effect_id: :obj:`str`
+
:param animation: Optional. Message is an animation, information about the animation. For backward
compatibility, when this field is set, the document field will also be set
:type animation: :class:`telebot.types.Animation`
@@ -986,6 +989,9 @@ class Message(JsonDeserializable):
commands, etc. that appear in the caption
:type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
+ :param show_caption_above_media: Optional. True, if the caption must be shown above the message media
+ :type show_caption_above_media: :obj:`bool`
+
:param has_media_spoiler: Optional. True, if the message media is covered by a spoiler animation
:type has_media_spoiler: :obj:`bool`
@@ -1370,6 +1376,10 @@ def de_json(cls, json_string):
opts['business_connection_id'] = obj['business_connection_id']
if 'is_from_offline' in obj:
opts['is_from_offline'] = obj['is_from_offline']
+ if 'effect_id' in obj:
+ opts['effect_id'] = obj['effect_id']
+ if 'show_caption_above_media' in obj:
+ opts['show_caption_above_media'] = obj['show_caption_above_media']
@@ -1479,6 +1489,8 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso
self.sender_business_bot: Optional[User] = None
self.business_connection_id: Optional[str] = None
self.is_from_offline: Optional[bool] = None
+ self.effect_id: Optional[str] = None
+ self.show_caption_above_media: Optional[bool] = None
for key in options:
setattr(self, key, options[key])
@@ -1586,12 +1598,12 @@ class MessageEntity(Dictionaryable, JsonSerializable, JsonDeserializable):
Telegram Documentation: https://core.telegram.org/bots/api#messageentity
- :param type: Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag”
- ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email”
- (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text),
- “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code”
- (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users
- without usernames), “custom_emoji” (for inline custom emoji stickers)
+ :param type: Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD),
+ “bot_command” (/start@jobs_bot),“url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123),
+ “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text),
+ “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation),
+ “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs),
+ “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
:type type: :obj:`str`
:param offset: Offset in UTF-16 code units to the start of the entity
@@ -4448,11 +4460,15 @@ class InlineQueryResultPhoto(InlineQueryResultBase):
:param input_message_content: Optional. Content of the message to be sent instead of the photo
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. If true, a caption is shown over the photo or video
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultPhoto`
"""
def __init__(self, id, photo_url, thumbnail_url, photo_width=None, photo_height=None, title=None,
- description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None):
+ description=None, caption=None, caption_entities=None, parse_mode=None, reply_markup=None, input_message_content=None,
+ show_caption_above_media=None):
super().__init__('photo', id, title = title, caption = caption,
input_message_content = input_message_content, reply_markup = reply_markup,
parse_mode = parse_mode, caption_entities = caption_entities)
@@ -4461,6 +4477,7 @@ def __init__(self, id, photo_url, thumbnail_url, photo_width=None, photo_height=
self.photo_width = photo_width
self.photo_height = photo_height
self.description = description
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
@property
def thumb_url(self):
@@ -4477,6 +4494,8 @@ def to_dict(self):
json_dict['photo_height'] = self.photo_height
if self.description:
json_dict['description'] = self.description
+ if self.show_caption_above_media is not None:
+ json_dict['show_caption_above_media'] = self.show_caption_above_media
return json_dict
@@ -4531,13 +4550,16 @@ class InlineQueryResultGif(InlineQueryResultBase):
:param input_message_content: Optional. Content of the message to be sent instead of the GIF animation
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. If true, a caption is shown over the photo or video
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultGif`
"""
def __init__(self, id, gif_url, thumbnail_url, gif_width=None, gif_height=None,
title=None, caption=None, caption_entities=None,
reply_markup=None, input_message_content=None, gif_duration=None, parse_mode=None,
- thumbnail_mime_type=None):
+ thumbnail_mime_type=None, show_caption_above_media=None):
super().__init__('gif', id, title = title, caption = caption,
input_message_content = input_message_content, reply_markup = reply_markup,
parse_mode = parse_mode, caption_entities = caption_entities)
@@ -4547,6 +4569,7 @@ def __init__(self, id, gif_url, thumbnail_url, gif_width=None, gif_height=None,
self.thumbnail_url = thumbnail_url
self.gif_duration = gif_duration
self.thumbnail_mime_type = thumbnail_mime_type
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
@property
def thumb_url(self):
@@ -4570,6 +4593,8 @@ def to_dict(self):
json_dict['gif_duration'] = self.gif_duration
if self.thumbnail_mime_type:
json_dict['thumbnail_mime_type'] = self.thumbnail_mime_type
+ if self.show_caption_above_media is not None:
+ json_dict['show_caption_above_media'] = self.show_caption_above_media
return json_dict
@@ -4624,13 +4649,16 @@ class InlineQueryResultMpeg4Gif(InlineQueryResultBase):
:param input_message_content: Optional. Content of the message to be sent instead of the video animation
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. If true, a caption is shown over the photo or video
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultMpeg4Gif`
"""
def __init__(self, id, mpeg4_url, thumbnail_url, mpeg4_width=None, mpeg4_height=None,
title=None, caption=None, caption_entities=None,
parse_mode=None, reply_markup=None, input_message_content=None, mpeg4_duration=None,
- thumbnail_mime_type=None):
+ thumbnail_mime_type=None, show_caption_above_media=None):
super().__init__('mpeg4_gif', id, title = title, caption = caption,
input_message_content = input_message_content, reply_markup = reply_markup,
parse_mode = parse_mode, caption_entities = caption_entities)
@@ -4640,6 +4668,7 @@ def __init__(self, id, mpeg4_url, thumbnail_url, mpeg4_width=None, mpeg4_height=
self.thumbnail_url = thumbnail_url
self.mpeg4_duration = mpeg4_duration
self.thumbnail_mime_type = thumbnail_mime_type
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
@property
def thumb_url(self):
@@ -4663,6 +4692,8 @@ def to_dict(self):
json_dict['mpeg4_duration '] = self.mpeg4_duration
if self.thumbnail_mime_type:
json_dict['thumbnail_mime_type'] = self.thumbnail_mime_type
+ if self.show_caption_above_media is not None:
+ json_dict['show_caption_above_media'] = self.show_caption_above_media
return json_dict
@@ -4721,13 +4752,16 @@ class InlineQueryResultVideo(InlineQueryResultBase):
required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. If true, a caption is shown over the video
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultVideo`
"""
def __init__(self, id, video_url, mime_type, thumbnail_url,
title, caption=None, caption_entities=None, parse_mode=None,
video_width=None, video_height=None, video_duration=None,
- description=None, reply_markup=None, input_message_content=None):
+ description=None, reply_markup=None, input_message_content=None, show_caption_above_media=None):
super().__init__('video', id, title = title, caption = caption,
input_message_content = input_message_content, reply_markup = reply_markup,
parse_mode = parse_mode, caption_entities = caption_entities)
@@ -4738,6 +4772,7 @@ def __init__(self, id, video_url, mime_type, thumbnail_url,
self.video_height = video_height
self.video_duration = video_duration
self.description = description
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
@property
def thumb_url(self):
@@ -4755,6 +4790,8 @@ def to_dict(self):
json_dict['video_duration'] = self.video_duration
if self.description:
json_dict['description'] = self.description
+ if self.show_caption_above_media is not None:
+ json_dict['show_caption_above_media'] = self.show_caption_above_media
return json_dict
@@ -5324,6 +5361,7 @@ def __init__(self):
self.parse_mode = None
self.caption_entities = None
self.payload_dic = {}
+ self.show_caption_above_media = None
def to_json(self):
json_dict = self.payload_dic
@@ -5343,6 +5381,8 @@ def to_json(self):
json_dict['parse_mode'] = self.parse_mode
if self.caption_entities:
json_dict['caption_entities'] = MessageEntity.to_list_of_dicts(self.caption_entities)
+ if self.show_caption_above_media is not None:
+ json_dict['show_caption_above_media'] = self.show_caption_above_media
return json.dumps(json_dict)
@@ -5385,12 +5425,15 @@ class InlineQueryResultCachedPhoto(InlineQueryResultCachedBase):
:param input_message_content: Optional. Content of the message to be sent instead of the photo
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. Pass True, if a caption is not required for the media
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultCachedPhoto`
"""
def __init__(self, id, photo_file_id, title=None, description=None,
caption=None, caption_entities = None, parse_mode=None,
- reply_markup=None, input_message_content=None):
+ reply_markup=None, input_message_content=None, show_caption_above_media=None):
InlineQueryResultCachedBase.__init__(self)
self.type = 'photo'
self.id = id
@@ -5403,6 +5446,7 @@ def __init__(self, id, photo_file_id, title=None, description=None,
self.input_message_content = input_message_content
self.parse_mode = parse_mode
self.payload_dic['photo_file_id'] = photo_file_id
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
@@ -5440,12 +5484,15 @@ class InlineQueryResultCachedGif(InlineQueryResultCachedBase):
:param input_message_content: Optional. Content of the message to be sent instead of the GIF animation
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. Pass True, if a caption is not required for the media
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultCachedGif`
"""
def __init__(self, id, gif_file_id, title=None, description=None,
caption=None, caption_entities = None, parse_mode=None,
- reply_markup=None, input_message_content=None):
+ reply_markup=None, input_message_content=None, show_caption_above_media=None):
InlineQueryResultCachedBase.__init__(self)
self.type = 'gif'
self.id = id
@@ -5458,6 +5505,7 @@ def __init__(self, id, gif_file_id, title=None, description=None,
self.input_message_content = input_message_content
self.parse_mode = parse_mode
self.payload_dic['gif_file_id'] = gif_file_id
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
@@ -5495,12 +5543,15 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResultCachedBase):
:param input_message_content: Optional. Content of the message to be sent instead of the video animation
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. Pass True, if caption should be shown above the media
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultCachedMpeg4Gif`
"""
def __init__(self, id, mpeg4_file_id, title=None, description=None,
caption=None, caption_entities = None, parse_mode=None,
- reply_markup=None, input_message_content=None):
+ reply_markup=None, input_message_content=None, show_caption_above_media=None):
InlineQueryResultCachedBase.__init__(self)
self.type = 'mpeg4_gif'
self.id = id
@@ -5513,7 +5564,7 @@ def __init__(self, id, mpeg4_file_id, title=None, description=None,
self.input_message_content = input_message_content
self.parse_mode = parse_mode
self.payload_dic['mpeg4_file_id'] = mpeg4_file_id
-
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
class InlineQueryResultCachedSticker(InlineQueryResultCachedBase):
@@ -5648,13 +5699,16 @@ class InlineQueryResultCachedVideo(InlineQueryResultCachedBase):
:param input_message_content: Optional. Content of the message to be sent instead of the video
:type input_message_content: :class:`telebot.types.InputMessageContent`
+ :param show_caption_above_media: Optional. Pass True, if a caption is not required for the media
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InlineQueryResultCachedVideo`
"""
def __init__(self, id, video_file_id, title, description=None,
caption=None, caption_entities = None, parse_mode=None,
reply_markup=None,
- input_message_content=None):
+ input_message_content=None, show_caption_above_media=None):
InlineQueryResultCachedBase.__init__(self)
self.type = 'video'
self.id = id
@@ -5667,6 +5721,7 @@ def __init__(self, id, video_file_id, title, description=None,
self.input_message_content = input_message_content
self.parse_mode = parse_mode
self.payload_dic['video_file_id'] = video_file_id
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
# noinspection PyUnresolvedReferences,PyShadowingBuiltins
@@ -6569,10 +6624,13 @@ class InputMediaPhoto(InputMedia):
:param has_spoiler: Optional. True, if the uploaded photo is a spoiler
:type has_spoiler: :obj:`bool`
+ :param show_caption_above_media: Optional. True, if the caption should be shown above the photo
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InputMediaPhoto`
"""
- def __init__(self, media, caption=None, parse_mode=None, caption_entities=None, has_spoiler=None):
+ def __init__(self, media, caption=None, parse_mode=None, caption_entities=None, has_spoiler=None, show_caption_above_media=None):
if service_utils.is_pil_image(media):
media = service_utils.pil_image_to_file(media)
@@ -6580,11 +6638,14 @@ def __init__(self, media, caption=None, parse_mode=None, caption_entities=None,
type="photo", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.has_spoiler: Optional[bool] = has_spoiler
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
def to_dict(self):
ret = super(InputMediaPhoto, self).to_dict()
if self.has_spoiler is not None:
ret['has_spoiler'] = self.has_spoiler
+ if self.show_caption_above_media is not None:
+ ret['show_caption_above_media'] = self.show_caption_above_media
return ret
@@ -6632,11 +6693,14 @@ class InputMediaVideo(InputMedia):
:param has_spoiler: Optional. True, if the uploaded video is a spoiler
:type has_spoiler: :obj:`bool`
+ :param show_caption_above_media: Optional. True, if the caption should be shown above the video
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InputMediaVideo`
"""
def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None,
- width=None, height=None, duration=None, supports_streaming=None, has_spoiler=None):
+ width=None, height=None, duration=None, supports_streaming=None, has_spoiler=None, show_caption_above_media=None):
super(InputMediaVideo, self).__init__(
type="video", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumbnail = thumbnail
@@ -6645,6 +6709,7 @@ def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption
self.duration = duration
self.supports_streaming = supports_streaming
self.has_spoiler: Optional[bool] = has_spoiler
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
@property
def thumb(self):
@@ -6665,6 +6730,8 @@ def to_dict(self):
ret['supports_streaming'] = self.supports_streaming
if self.has_spoiler is not None:
ret['has_spoiler'] = self.has_spoiler
+ if self.show_caption_above_media is not None:
+ ret['show_caption_above_media'] = self.show_caption_above_media
return ret
@@ -6709,11 +6776,14 @@ class InputMediaAnimation(InputMedia):
:param has_spoiler: Optional. True, if the uploaded animation is a spoiler
:type has_spoiler: :obj:`bool`
+ :param show_caption_above_media: Optional. True, if the caption should be shown above the animation
+ :type show_caption_above_media: :obj:`bool`
+
:return: Instance of the class
:rtype: :class:`telebot.types.InputMediaAnimation`
"""
def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption_entities=None,
- width=None, height=None, duration=None, has_spoiler=None):
+ width=None, height=None, duration=None, has_spoiler=None, show_caption_above_media=None):
super(InputMediaAnimation, self).__init__(
type="animation", media=media, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities)
self.thumbnail = thumbnail
@@ -6721,6 +6791,7 @@ def __init__(self, media, thumbnail=None, caption=None, parse_mode=None, caption
self.height = height
self.duration = duration
self.has_spoiler: Optional[bool] = has_spoiler
+ self.show_caption_above_media: Optional[bool] = show_caption_above_media
@property
def thumb(self):
@@ -6739,6 +6810,8 @@ def to_dict(self):
ret['duration'] = self.duration
if self.has_spoiler is not None:
ret['has_spoiler'] = self.has_spoiler
+ if self.show_caption_above_media is not None:
+ ret['show_caption_above_media'] = self.show_caption_above_media
return ret