dev #19
@ -1,5 +1,6 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
|
from pytimeparse.timeparse import timeparse
|
||||||
from modules.utils import configGet
|
from modules.utils import configGet
|
||||||
from modules.sender import send_content
|
from modules.sender import send_content
|
||||||
from modules.commands_register import register_commands
|
from modules.commands_register import register_commands
|
||||||
@ -8,10 +9,11 @@ from modules.app import app
|
|||||||
scheduler = AsyncIOScheduler()
|
scheduler = AsyncIOScheduler()
|
||||||
|
|
||||||
if configGet("post", "mode"):
|
if configGet("post", "mode"):
|
||||||
# for entry in configGet("time", "posting"):
|
if configGet("use_interval", "posting"):
|
||||||
# dt_obj = datetime.strptime(entry, "%H:%M")
|
scheduler.add_job(send_content, "interval", seconds=timeparse(configGet("interval", "posting")), args=[app])
|
||||||
# Is only used for debug now!
|
else:
|
||||||
scheduler.add_job(send_content, "interval", seconds=30, args=[app])
|
for entry in configGet("time", "posting"):
|
||||||
# scheduler.add_job(send_content, "cron", hour=dt_obj.hour, minute=dt_obj.minute, args=[app])
|
dt_obj = datetime.strptime(entry, "%H:%M")
|
||||||
|
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])
|
scheduler.add_job(register_commands, "date", run_date=datetime.now()+timedelta(seconds=10), args=[app])
|
@ -4,3 +4,4 @@ requests~=2.28.2
|
|||||||
psutil~=5.9.4
|
psutil~=5.9.4
|
||||||
pymongo~=4.3.3
|
pymongo~=4.3.3
|
||||||
pillow~=9.4.0
|
pillow~=9.4.0
|
||||||
|
pytimeparse~=1.1.8
|
Reference in New Issue
Block a user