Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Form_registration(StatesGroup):
- name = State()
- @dp.callback_query_handler(lambda c: c.data == 'edit_name')
- async def send_name(callback_query: types.CallbackQuery):
- await bot.answer_callback_query(callback_query.id)
- await Form_registration.name.set()
- await bot.send_message(callback_query.from_user.id, 'Укажите имя: ')
- @dp.message_handler(state=Form_registration.name)
- async def send_password(message: types.Message, state: FSMContext):
- async with state.proxy() as data:
- data['name'] = message.text
- user_id = message.chat.id
- r = requests.post(http_getusertoken, json={"password": "1488", "telegram_id": int(user_id)})
- TOKEN_USER = r.json()["access_token"]
- headers = {"Authorization": "Bearer " + TOKEN_USER}
- requests.post(http_setown, json={"firstName": message.text},
- headers=headers)
- await bot.send_message(message.chat.id, "Вы успешно изменили имя")
Add Comment
Please, Sign In to add comment