Moved to async

This commit is contained in:
2023-01-10 13:06:24 +01:00
parent 6facf428c5
commit c4323f0b00
8 changed files with 66 additions and 51 deletions

View File

@@ -1,11 +1,15 @@
from datetime import datetime
from datetime import datetime, timedelta
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from modules.utils import configGet
from modules.sender import send_content
from modules.commands_register import register_commands
from modules.app import app
scheduler = AsyncIOScheduler()
if configGet("post", "mode"):
for entry in configGet("time", "posting"):
dt_obj = datetime.strptime(entry, "%H:%M")
scheduler.add_job(send_content, "cron", hour=dt_obj.hour, minute=dt_obj.minute)
scheduler.add_job(send_content, "cron", hour=dt_obj.hour, minute=dt_obj.minute, args=[app])
scheduler.add_job(register_commands, "date", run_date=datetime.now()+timedelta(seconds=10), args=[app])