From c40c9dae67859ff50c58ec82c11fd146cfeae389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Tshipenchko?= Date: Mon, 3 Apr 2023 00:07:06 +0600 Subject: [PATCH] Fixed signature of startup/shutdown events - Include the **dispatcher.workflow_data as the handler arguments --- CHANGES/1155.bugfix.rst | 1 + aiogram/dispatcher/dispatcher.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 CHANGES/1155.bugfix.rst 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: