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