From 4f4c0891d9c6da96e212036c03d220e325e41598 Mon Sep 17 00:00:00 2001 From: Kwisatz Haderach <38349702+Otxoto@users.noreply.github.com> Date: Tue, 23 Jun 2020 20:10:12 +0200 Subject: [PATCH 1/4] Added thumb support to send_audio --- telebot/apihelper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 8a6ae75..93ba91a 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -541,7 +541,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 +567,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') From 29b432e65ad6d7a77ddd19c77472a08af897f547 Mon Sep 17 00:00:00 2001 From: Kwisatz Haderach <38349702+Otxoto@users.noreply.github.com> Date: Tue, 23 Jun 2020 20:12:46 +0200 Subject: [PATCH 2/4] Added thumb to send_audio --- telebot/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index ffde7e3..38867ad 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 @@ -713,7 +713,7 @@ class TeleBot: """ 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): From 53ccef5e5e3261468b19059f36c3a6319352c487 Mon Sep 17 00:00:00 2001 From: Kwisatz Haderach <38349702+Otxoto@users.noreply.github.com> Date: Tue, 23 Jun 2020 20:14:52 +0200 Subject: [PATCH 3/4] added thumb parameter to send_video --- telebot/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 38867ad..c182463 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -709,6 +709,7 @@ class TeleBot: :param parse_mode :param disable_notification: :param timeout: + :param thumb: :return: Message """ return types.Message.de_json( @@ -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): From 99de5490a05ffcbd63fefb1d97d696387231c7d0 Mon Sep 17 00:00:00 2001 From: Kwisatz Haderach <38349702+Otxoto@users.noreply.github.com> Date: Tue, 23 Jun 2020 20:17:21 +0200 Subject: [PATCH 4/4] Added thumb parameter to send_video --- telebot/apihelper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 93ba91a..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')