async def start_aiogram():
await dp.start_polling(bot)
async def start_scheduler():
scheduler = AsyncIOScheduler()
scheduler.add_job(func, trigger='cron', hour=12)
scheduler.start()
async def main():
await asyncio.gather(start_aiogram(),
start_scheduler() )
if __name__ == '__main__':
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(main())
except (KeyboardInterrupt, SystemExit):
pass