From bab96deffd8851effdbcb0952c7ac96d13d691df Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Sun, 9 Jan 2022 18:57:42 +0800 Subject: [PATCH] =?UTF-8?q?push=E7=9B=B8=E5=85=B3=E5=B0=8F=E6=94=B9?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/push.py b/push.py index 64ae450..2097fe0 100644 --- a/push.py +++ b/push.py @@ -6,8 +6,12 @@ cfg = ConfigParser() def load_config(): - cfg.read(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config'), 'push.ini'), - encoding='utf-8') + config_path = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config'), 'push.ini') + if os.path.exists(config_path): + cfg.read(config_path, encoding='utf-8') + return True + else: + return False def title(status): @@ -49,7 +53,8 @@ def cq_http(status, push_message): def push(status, push_message): - load_config() + if not load_config(): + return 0 if cfg.getboolean('setting', 'enable'): push_server = cfg.get('setting', 'push_server').lower() if push_server == "cqhttp":