Как присвоить номер контакта в State

bonuses={'998950895778':['2665','5830'], '912045858':['1255','13000'], '911458384':['7896','14000'],
 '999987311':['1111','15000'],
   '975950701':['2222',15000]}

storage=MemoryStorage()

class Proverka(StatesGroup):
    phone=State()
    code=State()

bot=Bot(token=TOKEN)
dp=Dispatcher(bot, storage=storage)


btn_contact=KeyboardButton(text="Отправить номер телефона",request_contact=True)
main_menu=ReplyKeyboardMarkup(resize_keyboard=True).add(btn_contact)

@dp.message_handler(commands='start',state=None) 
async def send_welcome(msg: types.Contact):
    await msg.answer("",reply_markup=main_menu)
    await Proverka.phone.set()

@dp.message_handler(state=Proverka.phone, content_types='contact' )
async def step1(msg: types.Contact, state: FSMContext,):
    if msg.contact.phone_number in bonuses.keys():
        global text
        text=bonuses[msg.contact.phone_number]
        await state.update_data(phone=msg.contact.phone_number)
        await msg.answer("Введите номер карты")
        await Proverka.code.set()
    else:
        await msg.answer("Нет такого номера")
        await state.finish()

Ответы (0 шт):