diff --git a/telebot/__init__.py b/telebot/__init__.py index ffde7e3..c182463 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -695,7 +695,7 @@ class TeleBot: def send_audio(self, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None, - timeout=None): + timeout=None, thumb=None): """ 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 format. :param chat_id:Unique identifier for the message recipient @@ -709,11 +709,12 @@ class TeleBot: :param parse_mode :param disable_notification: :param timeout: + :param thumb: :return: Message """ return types.Message.de_json( apihelper.send_audio(self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id, - reply_markup, parse_mode, disable_notification, timeout)) + reply_markup, parse_mode, disable_notification, timeout, thumb)) def send_voice(self, chat_id, voice, caption=None, duration=None, reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None, timeout=None): @@ -771,7 +772,7 @@ class TeleBot: disable_notification, timeout)) def send_video(self, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None): + parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None, thumb=None): """ Use this method to send video files, Telegram clients support mp4 videos. :param chat_id: Integer : Unique identifier for the message recipient — User or GroupChat id @@ -784,11 +785,12 @@ class TeleBot: :param reply_markup: :param disable_notification: :param timeout: + :param thumb: :return: """ return types.Message.de_json( apihelper.send_video(self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup, - parse_mode, supports_streaming, disable_notification, timeout)) + parse_mode, supports_streaming, disable_notification, timeout, thumb)) def send_animation(self, chat_id, animation, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, parse_mode=None, disable_notification=None, timeout=None): diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 8a6ae75..c4ab906 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -435,7 +435,7 @@ def send_chat_action(token, chat_id, action, timeout=None): def send_video(token, chat_id, data, duration=None, caption=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None): + parse_mode=None, supports_streaming=None, disable_notification=None, timeout=None, thumb=None): method_url = r'sendVideo' payload = {'chat_id': chat_id} files = None @@ -459,6 +459,11 @@ def send_video(token, chat_id, data, duration=None, caption=None, reply_to_messa payload['disable_notification'] = disable_notification if timeout: payload['connect-timeout'] = timeout + if thumb: + if not util.is_string(thumb): + files['thumb'] = thumb + else: + payload['thumb'] = thumb return _make_request(token, method_url, params=payload, files=files, method='post') @@ -541,7 +546,7 @@ def send_video_note(token, chat_id, data, duration=None, length=None, reply_to_m def send_audio(token, chat_id, audio, caption=None, duration=None, performer=None, title=None, reply_to_message_id=None, - reply_markup=None, parse_mode=None, disable_notification=None, timeout=None): + reply_markup=None, parse_mode=None, disable_notification=None, timeout=None, thumb=None): method_url = r'sendAudio' payload = {'chat_id': chat_id} files = None @@ -567,6 +572,11 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non payload['disable_notification'] = disable_notification if timeout: payload['connect-timeout'] = timeout + if thumb: + if not util.is_string(thumb): + files['thumb'] = thumb + else: + payload['thumb'] = thumb return _make_request(token, method_url, params=payload, files=files, method='post')