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

25 lines
788 B
Python
Raw Normal View History

2023-06-21 17:39:33 +03:00
from datetime import datetime
2023-01-10 13:52:44 +02:00
from apscheduler.schedulers.asyncio import AsyncIOScheduler
2023-06-21 17:39:33 +03:00
from libbot import sync
2023-02-17 22:54:30 +02:00
from pytimeparse.timeparse import timeparse
2023-01-10 13:52:44 +02:00
2023-06-21 17:39:33 +03:00
# from modules.sender import send_content
2023-01-10 13:52:44 +02:00
2023-06-21 17:39:33 +03:00
scheduler = AsyncIOScheduler()
2023-01-10 14:06:24 +02:00
2023-06-21 17:39:33 +03:00
# if sync.config_get("post", "mode"):
# if sync.config_get("use_interval", "posting"):
# scheduler.add_job(
# send_content,
# "interval",
# seconds=timeparse(sync.config_get("interval", "posting")),
# args=[app],
# )
# else:
# for entry in sync.config_get("time", "posting"):
# dt_obj = datetime.strptime(entry, "%H:%M")
# scheduler.add_job(
# send_content, "cron", hour=dt_obj.hour, minute=dt_obj.minute, args=[app]
# )