1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

has_spoiler parameter

Added the parameter has_spoiler to the methods sendPhoto, sendVideo, and sendAnimation.
This commit is contained in:
coder2020official
2022-12-30 19:20:23 +04:00
parent f0a1cefdda
commit 4d11e97c25
4 changed files with 56 additions and 18 deletions

View File

@@ -1763,7 +1763,8 @@ class TeleBot:
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
message_thread_id: Optional[int]=None) -> types.Message:
message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None) -> types.Message:
"""
Use this method to send photos. On success, the sent Message is returned.
@@ -1808,6 +1809,9 @@ class TeleBot:
:param message_thread_id: Identifier of a message thread, in which the message will be sent
:type message_thread_id: :obj:`int`
:param has_spoiler: Pass True, if the photo should be sent as a spoiler
:type has_spoiler: :obj:`bool`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
@@ -1821,7 +1825,7 @@ class TeleBot:
apihelper.send_photo(
self.token, chat_id, photo, caption, reply_to_message_id, reply_markup,
parse_mode, disable_notification, timeout, caption_entities,
allow_sending_without_reply, protect_content, message_thread_id))
allow_sending_without_reply, protect_content, message_thread_id, has_spoiler))
# TODO: Rewrite this method like in API.
def send_audio(
@@ -2171,7 +2175,8 @@ class TeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=None,
message_thread_id: Optional[int]=None) -> types.Message:
message_thread_id: Optional[int]=None,
has_spoiler: Optional[bool]=None) -> types.Message:
"""
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
@@ -2233,6 +2238,9 @@ class TeleBot:
:param message_thread_id: Identifier of a message thread, in which the video will be sent
:type message_thread_id: :obj:`int`
:param has_spoiler: Pass True, if the video should be sent as a spoiler
:type has_spoiler: :obj:`bool`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2249,7 +2257,7 @@ class TeleBot:
apihelper.send_video(
self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup,
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height,
caption_entities, allow_sending_without_reply, protect_content, message_thread_id))
caption_entities, allow_sending_without_reply, protect_content, message_thread_id, has_spoiler))
def send_animation(
self, chat_id: Union[int, str], animation: Union[Any, str],
@@ -2266,7 +2274,8 @@ class TeleBot:
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
message_thread_id: Optional[int]=None) -> types.Message:
message_thread_id: Optional[int]=None,
has_spoiler: 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.
@@ -2327,6 +2336,9 @@ class TeleBot:
:param message_thread_id: Identifier of a message thread, in which the video will be sent
:type message_thread_id: :obj:`int`
:param has_spoiler: Pass True, if the animation should be sent as a spoiler
:type has_spoiler: :obj:`bool`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@@ -2339,7 +2351,7 @@ class TeleBot:
apihelper.send_animation(
self.token, chat_id, animation, duration, caption, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb,
caption_entities, allow_sending_without_reply, protect_content, width, height, message_thread_id))
caption_entities, allow_sending_without_reply, protect_content, width, height, message_thread_id, has_spoiler))
# TODO: Rewrite this method like in API.
def send_video_note(