From aa7657a2c30841b48b83939436039cccb111554f Mon Sep 17 00:00:00 2001 From: Alexander Antsiferov Date: Sun, 25 Jun 2023 17:09:22 +0200 Subject: [PATCH] roll back aiogram upgrade --- dasbot.py | 7 +++++-- requirements.txt | 6 +++--- settings.toml | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dasbot.py b/dasbot.py index 54ca42f..1728fb9 100644 --- a/dasbot.py +++ b/dasbot.py @@ -86,12 +86,14 @@ async def all_other_messages(message: types.Message): broadcaster = Broadcaster(Interface(bot), chats_repo, dictionary) menucon = MenuController(Interface(bot), chats_repo) + broadcast_enabled = settings.get('BROADCAST') if settings.get('MODE').lower() == 'webhook': async def on_startup(dp): webhook_url = f"{settings.WEBHOOK_HOST}{settings.WEBHOOK_PATH}" log.info('setting webhook: %s', webhook_url) await bot.set_webhook(webhook_url) - asyncio.create_task(broadcaster.run()) + if broadcast_enabled: + asyncio.create_task(broadcaster.run()) async def on_shutdown(dp): await bot.delete_webhook() @@ -104,6 +106,7 @@ async def on_shutdown(dp): port=settings.WEBAPP_PORT) else: async def on_startup(dp): - asyncio.create_task(broadcaster.run()) + if broadcast_enabled: + asyncio.create_task(broadcaster.run()) executor.start_polling(dp, on_startup=on_startup, skip_updates=True) diff --git a/requirements.txt b/requirements.txt index add0c8f..0cd334d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -aiogram>=2.25 -aiohttp>=3.8.1,<3.9.0 +aiogram>=2.21 +aiohttp>=3.8.1 aiounittest>=1.4.2 dynaconf>=3.1.9 marshmallow>=3.17.0 mongomock>=4.1.2 pymongo>=4.2.0 -pytz>=2023.1 +pytz>=2022.1 watchdog[watchmedo]>=2.1.6 diff --git a/settings.toml b/settings.toml index 000e56d..989f79e 100644 --- a/settings.toml +++ b/settings.toml @@ -5,9 +5,11 @@ db_name = 'dasbot' [development] mode = 'polling' db_address = 'mongodb://127.0.0.1:27017/' +broadcast = false debug = true [production] mode = 'webhook' db_address = 'mongodb://mongo:27017/' +broadcast = true debug = false