1
0
Fork 0
forked from zovos/bot_tg

fix: uwu gifs now sent as animation, caption as separate message

This commit is contained in:
Omelechko Danil 2026-03-23 17:13:09 +03:00
parent 3baf71ab98
commit f0cefc7f23

View file

@ -68,15 +68,18 @@ async def handle_uwu_cmd(message: types.Message):
await message.reply("У найденного поста нет прямого URL изображения :(")
return
input_file = types.URLInputFile(file_url)
caption = random.choice(CAPTIONS)
if ext in ("png", "jpg", "jpeg", "webp"):
if ext in ("gif", "webm", "mp4"):
# Для анимаций: отправляем caption отдельным сообщением,
# а саму гифку/видео через URL напрямую — так Telegram
# корректно показывает её как анимацию, а не как файл
await message.answer(caption)
await message.answer_animation(animation=file_url)
elif ext in ("png", "jpg", "jpeg", "webp"):
input_file = types.URLInputFile(file_url)
await message.answer_photo(photo=input_file, caption=caption)
elif ext == "gif":
await message.answer_animation(animation=input_file, caption=caption)
elif ext in ("webm", "mp4"):
await message.answer_video(video=input_file, caption=caption)
else:
input_file = types.URLInputFile(file_url)
await message.answer_document(document=input_file, caption=caption)
except Exception as e: