From 6ecfd1b00ce8135bf7a0194e3c39c745590b18ed Mon Sep 17 00:00:00 2001 From: Heck Lawert Date: Mon, 9 Dec 2024 10:02:49 +0100 Subject: [PATCH 1/2] Fix issue with thumbnail in InputMedia types --- telebot/apihelper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 5ea37c4fd..3044b226d 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -2271,6 +2271,12 @@ def convert_input_media_array(array): if media_dict['media'].startswith('attach://'): key = media_dict['media'].replace('attach://', '') files[key] = input_media.media + if 'thumbnail' in media_dict: + thumbnail = media_dict['thumbnail'] + if isinstance(thumbnail, types.InputFile): + thumbnail_key = 'thumbnail_' + key + files[thumbnail_key] = thumbnail + media_dict['thumbnail'] = 'attach://' + thumbnail_key media.append(media_dict) return json.dumps(media), files From 63ddb1537f760027043d225ef540ab49a8013728 Mon Sep 17 00:00:00 2001 From: Heck Lawert Date: Thu, 12 Dec 2024 16:09:23 +0100 Subject: [PATCH 2/2] Fix issue with thumbnail in InputMedia types --- telebot/asyncio_helper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index 56604c750..d11245d56 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -2243,6 +2243,12 @@ async def convert_input_media_array(array): if media_dict['media'].startswith('attach://'): key = media_dict['media'].replace('attach://', '') files[key] = input_media.media + if 'thumbnail' in media_dict: + thumbnail = media_dict['thumbnail'] + if isinstance(thumbnail, types.InputFile): + thumbnail_key = 'thumbnail_' + key + files[thumbnail_key] = thumbnail + media_dict['thumbnail'] = 'attach://' + thumbnail_key media.append(media_dict) return json.dumps(media), files