Fix recursive .get_input_media() forgetting parameters

This commit is contained in:
Lonami Exo 2018-01-23 12:04:35 +01:00
parent f0eb41b902
commit 81c95b5a60

View File

@ -282,9 +282,10 @@ def get_input_media(media, user_caption=None, is_photo=False):
if isinstance(media, (ChatPhoto, UserProfilePhoto)): if isinstance(media, (ChatPhoto, UserProfilePhoto)):
if isinstance(media.photo_big, FileLocationUnavailable): if isinstance(media.photo_big, FileLocationUnavailable):
return get_input_media(media.photo_small, is_photo=True) media = media.photo_small
else: 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): if isinstance(media, MessageMediaContact):
return InputMediaContact( return InputMediaContact(
@ -312,7 +313,9 @@ def get_input_media(media, user_caption=None, is_photo=False):
return InputMediaEmpty() return InputMediaEmpty()
if isinstance(media, Message): 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') _raise_cast_fail(media, 'InputMedia')