From f0f27ef72a0bb93823cd3956de7255c0cd8124a1 Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Mon, 8 Apr 2024 17:10:12 +0000 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E8=B0=83=E7=94=A8=20send()?= =?UTF-8?q?=20=E6=97=B6=E9=87=8D=E6=96=B0=E6=A3=80=E6=9F=A5=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=B8=A0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/notify.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sample/notify.py b/sample/notify.py index 5c36d575..2a595308 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -113,7 +113,6 @@ push_config = { 'WEBHOOK_METHOD': '', # 自定义通知 请求方法 'WEBHOOK_CONTENT_TYPE': '' # 自定义通知 content-type } -notify_function = [] # fmt: on # 首先读取 面板变量 或者 github action 运行变量 @@ -840,6 +839,7 @@ def one() -> str: def add_notify_function(): + notify_function = [] if push_config.get("BARK_PUSH"): notify_function.append(bark) if push_config.get("CONSOLE"): @@ -897,6 +897,7 @@ def add_notify_function(): if not notify_function: print(f"无推送渠道,请检查通知变量是否正确") + return notify_function def send(title: str, content: str, ignore_default_config: bool = False, **kwargs): @@ -921,7 +922,7 @@ def send(title: str, content: str, ignore_default_config: bool = False, **kwargs hitokoto = push_config.get("HITOKOTO") content += "\n\n" + one() if hitokoto else "" - add_notify_function() + notify_function = add_notify_function() ts = [ threading.Thread(target=mode, args=(title, content), name=mode.__name__) for mode in notify_function