One-step FSM Error: Town() takes no arguments
@weather_router.message(Command("weather"))
class Town(StatesGroup):
town = State()
async def town(message: Message, state: FSMContext):
await message.answer(f"{message.from_user.first_name}, введи город")
await state.set_state(Town.town)
async def townn(message: Message):
await message.answer(f"Ваш город\n{message.text}")
I want bot to handle users “town” and send it him back by text message using FSM
@weather_router.message(Town.town)
await state.clear()
to "townn" function to clear FSM contextcode:
class Town(StatesGroup):
town = State()
@weather_router.message(Command('weather'))
async def town(message: Message, state: FSMContext):
await state.set_state(Town.town)
await message.answer(f"{message.from_user.first_name}, введи город")
@weather_router.message(Town.town)
async def townn(message: Message, state: FSMContext):
await message.answer(f"Ваш город\n{message.text}")
await state.clear()