Refactor startup and shutdown handlers in bot initialization for compatibility with aiogram event signature

- Wrapped the startup and shutdown handlers to ensure they conform to the aiogram event signature, allowing for proper argument handling.
- Updated the web server to access dispatcher workflow data directly, preventing sequence protocol issues and enhancing stability.
This commit is contained in:
machka-pasla
2025-08-17 12:13:08 +03:00
parent 87664a7735
commit ef9ebc1918
2 changed files with 10 additions and 4 deletions
+3 -2
View File
@@ -31,8 +31,9 @@ async def build_and_start_web_app(
"tribute_service",
"panel_webhook_service",
):
if key in dp: # type: ignore
app[key] = dp[key] # type: ignore
# Access dispatcher workflow_data directly to avoid sequence protocol issues
if hasattr(dp, "workflow_data") and key in dp.workflow_data: # type: ignore
app[key] = dp.workflow_data[key] # type: ignore
setup_application(app, dp, bot=bot)