From 4599ab7165ac2698800c5a7d9cc7cc4da8e71742 Mon Sep 17 00:00:00 2001 From: parkhomchukp <55126390+parkhomchukp@users.noreply.github.com> Date: Wed, 4 Aug 2021 14:51:37 +0300 Subject: [PATCH] Update bot.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Нельзя использовать with as, так как в Dispatcher не определен метод __enter__ --- lesson-03/bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lesson-03/bot.py b/lesson-03/bot.py index ecd0629..19d33b8 100644 --- a/lesson-03/bot.py +++ b/lesson-03/bot.py @@ -63,11 +63,11 @@ async def third_or_fourth_test_state_case_met(message: types.Message): @dp.message_handler(state=TestStates.all()) async def some_test_state_case_met(message: types.Message): - with dp.current_state(user=message.from_user.id) as state: - text = MESSAGES['current_state'].format( - current_state=await state.get_state(), - states=TestStates.all() - ) + state = dp.current_state(user=message.from_user.id) + text = MESSAGES['current_state'].format( + current_state=await state.get_state(), + states=TestStates.all() + ) await message.reply(text, reply=False)