Repository: Tishka17/aiogram_dialog (language: python)

Issue:
Removed bot instance passing when using fsm storage
fix for aiogram b8


Discussion / hints:

Fix patch:
diff --git a/pyproject.toml b/pyproject.toml
index 2bf417e8..28e5f0e9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,7 +25,7 @@ classifiers = [
     "Operating System :: OS Independent",
 ]
 dependencies = [
-    'aiogram>=3.0.0b5,<=3.0.0b7',
+    'aiogram>=3.0.0b8,<4.0.0',
     'jinja2',
     'cachetools>=4.0.0,<6.0.0',
     'magic_filter',
diff --git a/src/aiogram_dialog/context/storage.py b/src/aiogram_dialog/context/storage.py
index 2bba05d7..47d30d7b 100644
--- a/src/aiogram_dialog/context/storage.py
+++ b/src/aiogram_dialog/context/storage.py
@@ -28,7 +28,6 @@ def __init__(
 
     async def load_context(self, intent_id: str) -> Context:
         data = await self.storage.get_data(
-            bot=self.bot,
             key=self._context_key(intent_id),
         )
         if not data:
@@ -40,7 +39,6 @@ async def load_context(self, intent_id: str) -> Context:
 
     async def load_stack(self, stack_id: str = DEFAULT_STACK_ID) -> Stack:
         data = await self.storage.get_data(
-            bot=self.bot,
             key=self._stack_key(stack_id),
         )
         if not data:
@@ -53,21 +51,18 @@ async def save_context(self, context: Optional[Context]) -> None:
         data = copy(vars(context))
         data["state"] = data["state"].state
         await self.storage.set_data(
-            bot=self.bot,
             key=self._context_key(context.id),
             data=data,
         )
 
     async def remove_context(self, intent_id: str):
         await self.storage.set_data(
-            bot=self.bot,
             key=self._context_key(intent_id),
             data={},
         )
 
     async def remove_stack(self, stack_id: str):
         await self.storage.set_data(
-            bot=self.bot,
             key=self._stack_key(stack_id),
             data={},
         )
@@ -77,14 +72,12 @@ async def save_stack(self, stack: Optional[Stack]) -> None:
             return
         if stack.empty() and not stack.last_message_id:
             await self.storage.set_data(
-                bot=self.bot,
                 key=self._stack_key(stack.id),
                 data={},
             )
         else:
             data = copy(vars(stack))
             await self.storage.set_data(
-                bot=self.bot,
                 key=self._stack_key(stack.id),
                 data=data,
             )
diff --git a/src/aiogram_dialog/manager/updater.py b/src/aiogram_dialog/manager/updater.py
index fa1df92b..f31476cf 100644
--- a/src/aiogram_dialog/manager/updater.py
+++ b/src/aiogram_dialog/manager/updater.py
@@ -2,7 +2,6 @@
 from contextvars import copy_context
 
 from aiogram import Bot, Router
-from aiogram.types import Chat, User
 
 from aiogram_dialog.api.entities import DialogUpdate
 
@@ -23,9 +22,6 @@ def callback():
 
     async def _process_update(self, bot: Bot, update: DialogUpdate) -> None:
         event = update.event
-        Bot.set_current(bot)
-        User.set_current(event.from_user)
-        Chat.set_current(event.chat)
         await self.dp.propagate_event(
             update_type="update",
             event=update,


Test patch:
diff --git a/src/aiogram_dialog/test_tools/bot_client.py b/src/aiogram_dialog/test_tools/bot_client.py
index be5f3ee2..e6b6d933 100644
--- a/src/aiogram_dialog/test_tools/bot_client.py
+++ b/src/aiogram_dialog/test_tools/bot_client.py
@@ -21,6 +21,12 @@ def id(self):
     def __call__(self, *args, **kwargs) -> None:
         raise RuntimeError("Fake bot should not be used to call telegram")
 
+    def __hash__(self) -> int:
+        return 1
+
+    def __eq__(self, other) -> bool:
+        return self is other
+
 
 class BotClient:
     def __init__(