From ffee163d8206f0fb1315015e4c60248b68d459bc Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Mon, 23 Mar 2026 00:21:18 +0300 Subject: Add start, help and vpn_link commands --- handlers/user/info.py | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 handlers/user/info.py (limited to 'handlers/user/info.py') diff --git a/handlers/user/info.py b/handlers/user/info.py new file mode 100644 index 0000000..9776e7e --- /dev/null +++ b/handlers/user/info.py @@ -0,0 +1,77 @@ +from aiogram import Bot, Router +from aiogram.filters import Command +from aiogram.types import BotCommand, BotCommandScopeChat, Message + +from models import User + +router = Router(name="info") + +COMMANDS = [ + BotCommand( + command="start", + description="Показать стартовое сообщение", + ), + BotCommand( + command="help", + description="Показать список доступных команд", + ), + BotCommand( + command="vpn_link", + description="Показать ссылку доступа к VPN", + ), + BotCommand( + command="announcements", + description="Показать анонсы", + ), + BotCommand( + command="invoices", + description="Показать счета на оплату", + ), + BotCommand( + command="payments", + description="Показать платежи", + ), + BotCommand( + command="suggest_user", + description="Предложить нового пользователя", + ), +] + +ADMIN_COMMANDS = COMMANDS + [ + BotCommand( + command="new_announcement", + description="Создать новый анонс", + ), + BotCommand( + command="new_invoice", + description="Создать новый счёт на оплату", + ), + BotCommand( + command="add_user", + description="Создать нового пользователя", + ), + BotCommand( + command="suggest_list", + description="Показать предложения новых пользователей", + ), +] + + +@router.message(Command("start")) +async def start_command(msg: Message, bot: Bot, user: User) -> None: + await msg.answer( + "Добро пожаловать в бота для пользователей VPN.\n" + "Посмотреть список доступных команд: /help" + ) + + await bot.set_my_commands( + ADMIN_COMMANDS if user.is_admin() else COMMANDS, + BotCommandScopeChat(chat_id=user.id), + ) + + +@router.message(Command("help")) +async def help_command(msg: Message, user: User) -> None: + commands = ADMIN_COMMANDS if user.is_admin() else COMMANDS + commands_text = "\n".join(f"/{c.command} - {c.description}" for c in commands) + await msg.answer(f"Список доступных команд:\n{commands_text}") -- cgit v1.3