From 1df2790048fa989ff435136f9088a84b2a0496ab Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 19 Apr 2021 01:50:58 +0300 Subject: [PATCH] Fixed chat and user constraints --- aiogram/dispatcher/fsm/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiogram/dispatcher/fsm/middleware.py b/aiogram/dispatcher/fsm/middleware.py index 161976df..0ae1fef6 100644 --- a/aiogram/dispatcher/fsm/middleware.py +++ b/aiogram/dispatcher/fsm/middleware.py @@ -36,8 +36,8 @@ class FSMContextMiddleware(BaseMiddleware[Update]): def _resolve_context(self, data: Dict[str, Any]) -> Optional[FSMContext]: user = data.get("event_from_user") chat = data.get("event_chat") - user_id = chat.id if chat else None - chat_id = user.id if user else None + chat_id = chat.id if chat else None + user_id = user.id if user else None if chat_id is None: chat_id = user_id