fix start command in telegram bot

This commit is contained in:
2025-12-12 21:17:49 +05:00
parent 9ff2319990
commit c7454cbb62

View File

@ -5,6 +5,7 @@ from aiogram.types import Update, Message
from aiogram.fsm.state import State, StatesGroup from aiogram.fsm.state import State, StatesGroup
from aiogram.fsm.context import FSMContext from aiogram.fsm.context import FSMContext
from aiogram.fsm.storage.memory import MemoryStorage from aiogram.fsm.storage.memory import MemoryStorage
from aiogram.filters import CommandStart, CommandObject
from app.services.auth import AuthService from app.services.auth import AuthService
@ -26,11 +27,10 @@ class Register(StatesGroup):
# ===== Handlers ===== # ===== Handlers =====
@dp.message(F.text == "/start") @dp.message(CommandStart())
async def start(message: Message, state: FSMContext): async def start(message: Message, state: FSMContext, command: CommandObject):
args = message.text.split() if command.args:
if len(args) > 1: await state.update_data(username=command.args)
await state.update_data(username=args[1])
await state.set_state(Register.code) await state.set_state(Register.code)
await message.answer("📋 Введите код из лаунчера:") await message.answer("📋 Введите код из лаунчера:")
else: else: