From 81c95b5a607cc16e00732d0e0113eece5873c016 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 23 Jan 2018 12:04:35 +0100 Subject: [PATCH] Fix recursive .get_input_media() forgetting parameters --- telethon/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/telethon/utils.py b/telethon/utils.py index d113da73..16257be2 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -282,9 +282,10 @@ def get_input_media(media, user_caption=None, is_photo=False): if isinstance(media, (ChatPhoto, UserProfilePhoto)): if isinstance(media.photo_big, FileLocationUnavailable): - return get_input_media(media.photo_small, is_photo=True) + media = media.photo_small else: - return get_input_media(media.photo_big, is_photo=True) + media = media.photo_big + return get_input_media(media, user_caption=user_caption, is_photo=True) if isinstance(media, MessageMediaContact): return InputMediaContact( @@ -312,7 +313,9 @@ def get_input_media(media, user_caption=None, is_photo=False): return InputMediaEmpty() if isinstance(media, Message): - return get_input_media(media.media) + return get_input_media( + media.media, user_caption=user_caption, is_photo=is_photo + ) _raise_cast_fail(media, 'InputMedia')