From 88ceb2ef29d5890269c9046dca460f124daf84d9 Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 20 Apr 2026 18:11:39 +0300 Subject: [PATCH] feat: spoiler for explicit content in /uwu and /nude --- .env | 1 + games/nude.py | 4 ++-- games/uwu.py | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 8be3f47..5ad177a 100644 --- a/.env +++ b/.env @@ -4,3 +4,4 @@ ODDS_API_KEY=c29bc26dee8aa9d95a5ce8d14ea63923 LLAMA_API_URL=https://mirror.porno4free.ru/zovos-ai/ LLAMA_FORCE_DISABLE_THINKING=0 LLAMA_LOG_THINKING=1 +WEBAPP_URL=https://uninterleaved-scrawnily-nicol.ngrok-free.dev diff --git a/games/nude.py b/games/nude.py index 46e4c36..b1c024d 100644 --- a/games/nude.py +++ b/games/nude.py @@ -302,12 +302,12 @@ async def handle_nude_cmd(message: types.Message): if image_bytes: photo = types.BufferedInputFile(image_bytes, filename=filename) - await message.answer_photo(photo=photo, caption=caption) + await message.answer_photo(photo=photo, caption=caption, has_spoiler=True) return try: photo = types.URLInputFile(selected["image_url"]) - await message.answer_photo(photo=photo, caption=caption) + await message.answer_photo(photo=photo, caption=caption, has_spoiler=True) except Exception: logger.exception("Failed to send photo by URL") await message.answer( diff --git a/games/uwu.py b/games/uwu.py index 73a85ec..e5ff65e 100644 --- a/games/uwu.py +++ b/games/uwu.py @@ -84,6 +84,7 @@ async def fetch_uwu_post(tags: str) -> dict: post = posts[0] file_url = post.get("file", {}).get("url") ext = post.get("file", {}).get("ext", "png") + rating = post.get("rating", "s") # s=safe, q=questionable, e=explicit if not file_url: raise Exception("У найденного поста нет прямого URL изображения :(") @@ -91,7 +92,8 @@ async def fetch_uwu_post(tags: str) -> dict: return { "url": file_url, "ext": ext, - "caption": caption + "caption": caption, + "rating": rating } async def fetch_furtok_feed(safe: bool = True, page: int = 1, extra_tags: str = "") -> list[dict]: @@ -178,16 +180,17 @@ async def handle_uwu_cmd(message: types.Message): file_url = post["url"] ext = post["ext"] caption = post["caption"] + spoiler = post.get("rating") == "e" # спойлер для explicit if ext in ("gif", "webm", "mp4"): # Для анимаций: отправляем caption отдельным сообщением, # а саму гифку/видео через URL напрямую — так Telegram # корректно показывает её как анимацию, а не как файл await message.answer(caption) - await message.answer_animation(animation=file_url) + await message.answer_animation(animation=file_url, has_spoiler=spoiler) 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, has_spoiler=spoiler) else: input_file = types.URLInputFile(file_url) await message.answer_document(document=input_file, caption=caption) -- 2.45.2