diff --git a/games/uwu.py b/games/uwu.py
index 1301bfa..0ad5108 100644
--- a/games/uwu.py
+++ b/games/uwu.py
@@ -2,9 +2,15 @@ import aiohttp
from aiogram import types
import config
import logging
+import random
logger = logging.getLogger(__name__)
+CAPTIONS = [
+ "Ня :3",
+ "uwu"
+]
+
async def handle_uwu_cmd(message: types.Message):
args = message.text.split(maxsplit=1)
@@ -16,12 +22,12 @@ async def handle_uwu_cmd(message: types.Message):
"• score: score:>500 (искать популярные посты с рейтингом больше 500)\n"
"• Исключить тег: поставьте минус, например -fox\n\n"
"Пример: /uwu wolf -rating:explicit score:>100\n"
- "По умолчанию: rating:safe score:>500"
+ "По умолчанию: rating:safe score:>500 -animated"
)
await message.reply(help_msg, parse_mode="HTML")
return
- tags = "rating:safe score:>500"
+ tags = "rating:safe score:>500 -animated"
if len(args) > 1:
tags = args[1].strip()
@@ -57,11 +63,21 @@ async def handle_uwu_cmd(message: types.Message):
post = posts[0]
file_url = post.get("file", {}).get("url")
+ ext = post.get("file", {}).get("ext", "png")
if not file_url:
await message.reply("У найденного поста нет прямого URL изображения :(")
return
- await message.answer_photo(photo=types.URLInputFile(file_url), caption="Ня :3")
+ input_file = types.URLInputFile(file_url)
+ caption = random.choice(CAPTIONS)
+ if ext in ("png", "jpg", "jpeg", "webp"):
+ 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:
+ await message.answer_document(document=input_file, caption=caption)
except Exception as e:
logger.exception("Error in uwu command")