Please tell me, the bot starts up, but the states do not work, you click to view the profile, but nothing happens, what can I fix in the code?

from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher import FSMContext
import config
import random
from on_startup_notify import on_startup_notify
from memorystate import Test
from aiogram import types, Bot, executor, Dispatcher
bot= Bot (token= config.BOT_TOKEN, parse_mode= types.ParseMode.HTML)
dp= Dispatcher (bot)
storage= MemoryStorage ()
async def on_startup (dispatcher):
    await on_startup_notify (dispatcher)
@ dp.message_handler (commands= ['start'])
async def startpg (message: types.Message, state: FSMContext):
    startmenu= types.ReplyKeyboardMarkup (resize_keyboard= True, row_width= 2)
    markup1= types.KeyboardButton ("View profile")
    startmenu.add (markup1)
    await bot.send_message (chat_id= message.chat.id, text= 'Welcome! \ nOur bot will introduce you to girls from your city! Click to view the profile!', reply_markup= startmenu)
    await state.set_data (Test.N1)
@ dp.message_handler (text= ['View profile'], state= Test.N1)
async def osnova (message: types.Message, state: FSMContext):
    await bot.send_message (message.chat.id, 'Enter your name:')
    answer= message.text
    await state.update_data (answer1= answer)
    await Test.N2.set ()

firstly, you set the states in different ways, secondly -check if it is set at all, thirdly -your state is set when you start command, and not when you press a button

finally2021-02-28 17:35:12

I tried to install it in different ways, it does not help, but how to check if the state is being set? what to fix in this code? everything seems to be ready to go

Иван Сидоров2021-02-28 17:35:12