fix: stavki v2 #18

Merged
q merged 4 commits from Dan4ick/bot_tg:feature/FenyaBot into main 2026-03-23 16:45:36 +00:00
Showing only changes of commit f0cefc7f23 - Show all commits

View file

@ -68,15 +68,18 @@ async def handle_uwu_cmd(message: types.Message):
await message.reply("У найденного поста нет прямого URL изображения :(") await message.reply("У найденного поста нет прямого URL изображения :(")
return return
input_file = types.URLInputFile(file_url)
caption = random.choice(CAPTIONS) 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) 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: else:
input_file = types.URLInputFile(file_url)
await message.answer_document(document=input_file, caption=caption) await message.answer_document(document=input_file, caption=caption)
except Exception as e: except Exception as e: