diff --git a/CHANGES/1155.bugfix.rst b/CHANGES/1155.bugfix.rst new file mode 100644 index 00000000..753ffc96 --- /dev/null +++ b/CHANGES/1155.bugfix.rst @@ -0,0 +1 @@ +Fixed signature of startup/shutdown events to include the **dispatcher.workflow_data as the handler arguments. diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index a7124d44..8485d83c 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -488,8 +488,13 @@ class Dispatcher(Router): signal.SIGINT, self._signal_stop_polling, signal.SIGINT ) - workflow_data = {"dispatcher": self, "bots": bots, "bot": bots[-1]} - workflow_data.update(kwargs) + workflow_data = { + "dispatcher": self, + "bots": bots, + "bot": bots[-1], + **kwargs, + **self.workflow_data, + } await self.emit_startup(**workflow_data) loggers.dispatcher.info("Start polling") try: