Answer the question
In order to leave comments, you need to log in
Aiogram, how to assign value to State before user enters value after set()?
Tried this but doesn't work, gives - KeyError: 'item_id'
await states.NewItem.item_name.set()
state = dp.current_state(user=user_id)
await state.update_data(item_id=item_id)
Answer the question
In order to leave comments, you need to log in
To access data in the state, write in the function:
async def start_bot(message: types.Message, state: FSMContext):
state = dp.current_state(user=user_id)
, because you reassign it FSMContext
to dp.current_state(user=user_id)
await state.update_data(item_id=item_id)
will be successful
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question