diff options
Diffstat (limited to 'commands.py')
| -rw-r--r-- | commands.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/commands.py b/commands.py index ace141e..afec430 100644 --- a/commands.py +++ b/commands.py @@ -20,12 +20,53 @@ from aiogram.types import ( ) from aiogram.utils.deep_linking import create_start_link +from collections import Counter + from colors import * from config import * +from statistics import * from supergenerator import * router = Router() +@router.message(Command("stats")) +async def stats_handler(message: Message): + users = get_all_users() + + total_users = len(users) + + models = Counter() + streams = Counter() + calls = Counter() + + for data in users.values(): + if isinstance(data, dict): + models[data.get("model")] += 1 + streams[data.get("stream")] += 1 + calls[data.get("call")] += 1 + + top_models = models.most_common(3) + top_streams = streams.most_common(3) + + text = [ + "✅ *общая статистика*", + f"☝️пользователей: {total_users}", + f"📞всего генераций: {get_stats('stats/gens')}", + f"👻ген в гостевом: {get_stats('stats/guest')}", + f"🙏ген в инлайне: {get_stats('stats/inline')}", + f"🤝ben: {get_stats('stats/ben')}", + f"🤝reporn: {get_stats('stats/reporn')}", + "🥺топ моделей:", + *(f"- `{m}`: {c}" for m, c in top_models), + "✍️топ режимов стрима:", + *(f"- `{s}`: {c}" for s, c in top_streams), + "👀топ режимов вызова:", + *(f"- `{c}`: {n}" for c, n in calls.most_common()), + ] + + await message.reply("\n".join(text)) + + @router.message(Command("broadcast")) async def broadcast_handler(message: Message): @@ -63,6 +104,7 @@ async def start_handler(message: Message): await message.reply( "вы забанены за Botting, spamming, and coordinated inauthentic behavior.😡✅" ) + add_one_to("stats/ben") return @@ -74,6 +116,7 @@ async def start_handler(message: Message): await message.reply( f"отправлен репорт на {user_name}!" ) + add_one_to("stats/reporn") return |