Skip to content

Commit

Permalink
roll back aiogram upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
wetterkrank committed Jun 25, 2023
1 parent 4e87647 commit aa7657a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dasbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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)
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit aa7657a

Please sign in to comment.