Fixed Dispatcher._process_update

This commit is contained in:
Alex Root Junior 2021-04-19 22:06:10 +03:00
parent 33a6c769d5
commit 51f0b77a9e
2 changed files with 2 additions and 4 deletions

View file

@ -233,13 +233,11 @@ class Dispatcher(Router):
:param kwargs: contextual data for middlewares, filters and handlers
:return: status
"""
handled = False
try:
response = await self.feed_update(bot, update, **kwargs)
handled = handled is not UNHANDLED
if call_answer and isinstance(response, TelegramMethod):
await self._silent_call_request(bot=bot, result=response)
return handled
return response is not UNHANDLED
except Exception as e:
loggers.dispatcher.exception(

View file

@ -157,7 +157,7 @@ class TestDispatcher:
dispatcher = Dispatcher()
result = await dispatcher._process_update(bot=bot, update=Update(update_id=42))
assert result
assert not result
@pytest.mark.asyncio
async def test_process_update_handled(self, bot: MockedBot):