diff --git a/poster.py b/poster.py index 1c327e3..b128c06 100644 --- a/poster.py +++ b/poster.py @@ -157,27 +157,33 @@ def send_content(): else: caption = caption - if ext_type == "photo": # type: ignore + try: + if ext_type == "photo": # type: ignore - if configGet("enabled", "caption"): - if configGet("link", "caption") != None: - sent = app.send_photo(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore + if configGet("enabled", "caption"): + if configGet("link", "caption") != None: + sent = app.send_photo(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore + else: + sent = app.send_photo(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore else: sent = app.send_photo(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore - else: - sent = app.send_photo(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore - elif ext_type == "video": # type: ignore + elif ext_type == "video": # type: ignore - if configGet("enabled", "caption"): - if configGet("link", "caption") != None: - sent = app.send_video(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore + if configGet("enabled", "caption"): + if configGet("link", "caption") != None: + sent = app.send_video(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore + else: + sent = app.send_video(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore else: sent = app.send_video(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore - else: - sent = app.send_video(configGet("channel", "posting"), candidate, caption=caption, disable_notification=configGet("silent", "posting")) # type: ignore - else: + else: + return + except Exception as exp: + logWrite(locale("post_exception", "console", locale=configGet("locale_log")).format(str(exp), format_exc())) + if configGet("error", "reports"): + app.send_message(configGet("admin"), locale("post_exception", "message", locale=configGet("locale")).format(exp, traceback.format_exc())) # type: ignore return index["sent"].append(candidate_file) @@ -199,7 +205,7 @@ def send_content(): logWrite(locale("post_exception", "console", locale=configGet("locale_log")).format(str(exp), format_exc())) if configGet("error", "reports"): app.send_message(configGet("admin"), locale("post_exception", "message", locale=configGet("locale")).format(exp, traceback.format_exc())) # type: ignore - pass + return # Work in progress