Fix bot instance passing in Dispatcher startup (#1247)

Modified the Dispatcher to remove the "bot" key from workflow_data if found, prior to emitting startup in order to allow manual addition of "bot" to workflow data. This change was necessary as a bot instance is required to start polling, and therefore must be passed correctly. This logic is now tested in the 'test_start_polling' function. The change also includes an update to the changelog.
This commit is contained in:
Alex Root Junior 2023-08-06 01:14:26 +03:00 committed by GitHub
parent 90654ac0fa
commit 62d4b9014c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View file

@ -516,6 +516,9 @@ class Dispatcher(Router):
**self.workflow_data,
**kwargs,
}
if "bot" in workflow_data:
workflow_data.pop("bot")
await self.emit_startup(bot=bots[-1], **workflow_data)
loggers.dispatcher.info("Start polling")
try: