Fixed signature of startup/shutdown events

- Include the **dispatcher.workflow_data as the handler arguments
This commit is contained in:
Łukasz Tshipenchko 2023-04-03 00:07:06 +06:00
parent 1f03b0ad39
commit c40c9dae67
2 changed files with 8 additions and 2 deletions

1
CHANGES/1155.bugfix.rst Normal file
View file

@ -0,0 +1 @@
Fixed signature of startup/shutdown events to include the **dispatcher.workflow_data as the handler arguments.

View file

@ -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: