From 00adbdfc65d96d3b8c2b04ee625db6e4b1f7cf6d Mon Sep 17 00:00:00 2001 From: Deer-Spangle <60626596+Deer-Spangle@users.noreply.github.com> Date: Fri, 25 Jul 2025 13:20:00 +0100 Subject: [PATCH] Fix spoilers when sending InputPhoto and InputDocument After this was reported as a problem for MessageMediaPhoto objects in #4584, it was fixed in commit 37e29e8, but the problem exists for InputPhoto and InputDocument, also. This commit fixes that --- telethon/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telethon/utils.py b/telethon/utils.py index c0c48d4d..234dd71e 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -437,9 +437,9 @@ def get_input_media( if media.SUBCLASS_OF_ID == 0xfaf846f4: # crc32(b'InputMedia') return media elif media.SUBCLASS_OF_ID == 0x846363e0: # crc32(b'InputPhoto') - return types.InputMediaPhoto(media, ttl_seconds=ttl) + return types.InputMediaPhoto(media, ttl_seconds=ttl, spoiler=media.spoiler) elif media.SUBCLASS_OF_ID == 0xf33fdb68: # crc32(b'InputDocument') - return types.InputMediaDocument(media, ttl_seconds=ttl) + return types.InputMediaDocument(media, ttl_seconds=ttl, spoiler=media.spoiler) except AttributeError: _raise_cast_fail(media, 'InputMedia')