Files
Solo_bot/main.py
T
2024-09-29 02:14:49 +03:00

21 lines
654 B
Python

import asyncio
from bot import bot, dp, router
from database import init_db
from handlers.notifications import notify_expiring_keys
async def periodic_notifications():
while True:
await notify_expiring_keys(bot)
await asyncio.sleep(3600) # Проверяем каждый час
async def main():
await init_db()
dp.include_router(router) # Подключение роутера
asyncio.create_task(periodic_notifications()) # Запуск фоновой задачи для уведомлений
await dp.start_polling(bot) # Запуск поллинга
if __name__ == '__main__':
asyncio.run(main())