Changed a bit more due to "modes" update

This commit is contained in:
Profitroll 2022-08-30 14:03:11 +02:00
parent da97606bb4
commit 5848bca40a
1 changed files with 19 additions and 18 deletions

View File

@ -396,25 +396,26 @@ def callback_query_unblock(app, clb): # type: ignore
# # else: # # else:
# # logWrite(f"Got raw update of type {type(update)} with contents {update}", debug=True) # # logWrite(f"Got raw update of type {type(update)} with contents {update}", debug=True)
for entry in configGet("time", "posting"): if configGet("mode") in ["both", "post"]:
schedule.every().day.at(entry).do(send_content)
for entry in configGet("time", "posting"):
schedule.every().day.at(entry).do(send_content)
def background_task():
def background_task(): try:
try: while True:
while True: try:
try: schedule.run_pending()
schedule.run_pending() time.sleep(1)
time.sleep(1) except:
except: pass
pass except Exception as exp:
except Exception as exp: logWrite(locale("exception_occured", "console", locale=configGet("locale")).format(exp))
logWrite(locale("exception_occured", "console", locale=configGet("locale")).format(exp)) except KeyboardInterrupt:
except KeyboardInterrupt: logWrite(locale("keyboard_interrupt", "console", locale=configGet("locale")))
logWrite(locale("keyboard_interrupt", "console", locale=configGet("locale"))) if configGet("shutdown", "reports"):
if configGet("shutdown", "reports"): app.send_message(configGet("admin"), locale("shutdown", "message", locale=configGet("locale")).format(str(pid))) # type: ignore
app.send_message(configGet("admin"), locale("shutdown", "message", locale=configGet("locale")).format(str(pid))) # type: ignore killProc(pid)
killProc(pid)
if __name__ == "__main__": if __name__ == "__main__":