From 0f0af0c19438d92a019373a8da385c53c113fa9b Mon Sep 17 00:00:00 2001 From: Zakhar Izmaylov Date: Sun, 17 Nov 2024 15:53:31 +0300 Subject: [PATCH] Fix start --- bot.py | 3 ++- handlers/commands.py | 17 +++++++++++++++++ handlers/start.py | 2 -- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 handlers/commands.py diff --git a/bot.py b/bot.py index ef103799..310fa61d 100644 --- a/bot.py +++ b/bot.py @@ -11,7 +11,7 @@ storage = MemoryStorage() dp = Dispatcher(bot=bot, storage=storage) router = Router() -from handlers import coupons, donate, notifications, pay, profile, start +from handlers import commands, coupons, donate, notifications, pay, profile, start from handlers.admin import admin_commands, admin_coupons, admin_panel, admin_user_editor from handlers.instructions import instructions from handlers.keys import key_management, keys @@ -21,6 +21,7 @@ dp.include_router(admin_commands.router) dp.include_router(admin_coupons.router) dp.include_router(admin_panel.router) dp.include_router(admin_user_editor.router) +dp.include_router(commands.router) dp.include_router(coupons.router) dp.include_router(start.router) dp.include_router(profile.router) diff --git a/handlers/commands.py b/handlers/commands.py new file mode 100644 index 00000000..09e38e8f --- /dev/null +++ b/handlers/commands.py @@ -0,0 +1,17 @@ +from aiogram import Router, types +from aiogram.filters import Command +from aiogram.fsm.context import FSMContext + +from handlers.start import start_command + +router = Router() + + +@router.message(Command("start")) +async def handle_start(message: types.Message, state: FSMContext, admin: bool): + await start_command(message, admin) + + +@router.message(Command("menu")) +async def handle_menu(message: types.Message, state: FSMContext, admin: bool): + await start_command(message, admin) diff --git a/handlers/start.py b/handlers/start.py index 2b811289..b9532340 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -1,7 +1,6 @@ import os from aiogram import F, Router -from aiogram.filters import Command from aiogram.types import BufferedInputFile, CallbackQuery, InlineKeyboardButton, Message from aiogram.utils.keyboard import InlineKeyboardBuilder @@ -56,7 +55,6 @@ async def send_welcome_message(chat_id: int, trial_status: int, admin: bool): ) -@router.message(Command("start"), Command("menu")) async def start_command(message: Message, admin: bool): logger.info(f"Received start command with text: {message.text}") if "referral_" in message.text: