Advertisement
Guest User

Untitled

a guest
Jan 24th, 2022
31
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from aiogram import executor, types
  2. from aiogram.dispatcher import FSMContext
  3. from aiogram.dispatcher.filters.state import StatesGroup, State
  4.  
  5. from loader import dp
  6.  
  7.  
  8. class Sasd(StatesGroup):
  9.     qwe = State()
  10.  
  11.  
  12. @dp.message_handler(commands=["start"])
  13. async def handler(message: types.Message, state: FSMContext):
  14.     user_id_player_1 = message.from_user.id
  15.     await state.update_data(user_id_player_2=message.text)
  16.     await state.update_data(user_id_player_1=user_id_player_1)
  17.     user_id_players = await state.get_data()
  18.     await state.reset_state(with_data=False)
  19.     print(user_id_players['user_id_player_1'])
  20.  
  21.  
  22. @dp.message_handler()
  23. async def asd(call: types.CallbackQuery, state: FSMContext):
  24.     user_id_players = await state.get_data()
  25.     player_1 = user_id_players.get("user_id_player_2")
  26.     print(player_1)
  27.     await state.finish()
  28.  
  29.  
  30. if __name__ == '__main__':
  31.     executor.start_polling(dp)
Advertisement
RAW Paste Data Copied
Advertisement