From 0e429f668bc090e2a804f19d0e25d83d5c61440e Mon Sep 17 00:00:00 2001 From: King-of-the-all-Cookies Date: Fri, 1 May 2026 18:56:37 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4:=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=D0=BD=D0=BE=D0=B9=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D0=BB=D0=BB=D1=8B=20=D0=B8=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20=D1=82=D0=BE=D0=BF-10=20=D0=BD=D0=BE=D0=B2=D0=B5=D0=BB?= =?UTF-8?q?=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/bot.py b/bot.py index 1495f1d..6f8ecce 100644 --- a/bot.py +++ b/bot.py @@ -3,7 +3,6 @@ import logging import re import httpx import random -import random from aiogram import Bot, Dispatcher, types from aiogram.filters import Command, CommandObject from aiogram.client.default import DefaultBotProperties @@ -110,38 +109,10 @@ async def handle_vn(message: types.Message, command: CommandObject): ) await send_result(message, text, img) -@dp.message(Command("random")) -async def handle_random(message: types.Message): - """Выбирает случайную новеллу из 50 популярных с высоким рейтингом.""" - # Фильтр: рейтинг > 75, популярность высокая - res = await fetch_vndb("vn", ["rating", ">=", 75], "id, title, image{url}, rating, description", sort="votecount", results=50) - if not res: return await message.answer("❌ API error") - - v = random.choice(res) - text = ( - f"🎲 RANDOM VN PICK\n\n" - f"TITLE: {v['title']}\n" - f"RATING: {v['rating']/10} ⭐\n\n" - f"DESCRIPTION:\n{clean_text(v.get('description'), 300)}\n\n" - f"VNDB: https://vndb.org/{v['id']}" - ) - await send_result(message, text, v.get('image', {}).get('url')) - -@dp.message(Command("top")) -async def handle_top(message: types.Message): - """Выводит топ-10 новелл по рейтингу.""" - res = await fetch_vndb("vn", ["votecount", ">", 1000], "id, title, rating", sort="rating", results=10) - if not res: return await message.answer("❌ API error") - - out = ["🏆 TOP RATED VISUAL NOVELS\n"] - for i, v in enumerate(res, 1): - out.append(f"{i}. {v['title']} — {v['rating']/10} ({v['id']})") - - await message.answer("\n".join(out)) - @dp.message(Command("char")) async def handle_char(message: types.Message, command: CommandObject): if not command.args: return await message.answer("Usage: /char ") + is_id = command.args.startswith('c') and command.args[1:].isdigit() filt = ["id", "=", command.args] if is_id else ["search", "=", command.args] fields = "id, name, original, description, gender, age, blood_type, image{url}"