diff --git a/bot.py b/bot.py
index 6f8ecce..1495f1d 100644
--- a/bot.py
+++ b/bot.py
@@ -3,6 +3,7 @@ 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
@@ -109,10 +110,38 @@ 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}"