This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
TelegramPoster/modules/scheduler.py
2023-02-14 16:26:08 +01:00

17 lines
742 B
Python

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")
# Is only used for debug now!
scheduler.add_job(send_content, "interval", seconds=30, args=[app])
# 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])