From 2b8d1877d7e40e8878c0fca0cb3aa6dcabc8f883 Mon Sep 17 00:00:00 2001 From: pharaoh2012 <2225220+pharaoh2012@users.noreply.github.com> Date: Fri, 3 Mar 2023 10:39:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=A0=87=E9=A2=98=E8=B7=B3?= =?UTF-8?q?=E8=BF=87=E4=B8=80=E4=BA=9B=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?= =?UTF-8?q?=EF=BC=8C=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=EF=BC=9ASKIP=5FPU?= =?UTF-8?q?SH=5FTITLE=20=E7=94=A8=E5=9B=9E=E8=BD=A6=E5=88=86=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/notify.js | 10 ++++++++++ sample/notify.py | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/sample/notify.js b/sample/notify.js index 6f3da33b..d2e03ddd 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -296,6 +296,16 @@ async function sendNotify( ) { //提供6种通知 desp += author; //增加作者信息,防止被贩卖等 + + // 根据标题跳过一些消息推送,环境变量:SKIP_PUSH_TITLE 用回车分隔 + let skipTitle = process.env.SKIP_PUSH_TITLE + if(skipTitle) { + if(skipTitle.split('\n').includes(text)) { + console.info(text + "在SKIP_PUSH_TITLE环境变量内,跳过推送!"); + return + } + } + await Promise.all([ serverNotify(text, desp), //微信server酱 pushPlusNotify(text, desp), //pushplus(推送加) diff --git a/sample/notify.py b/sample/notify.py index 79ac9fb2..e8ab06f0 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -647,6 +647,13 @@ def send(title: str, content: str) -> None: print(f"{title} 推送内容为空!") return + # 根据标题跳过一些消息推送,环境变量:SKIP_PUSH_TITLE 用回车分隔 + skipTitle = os.getenv("SKIP_PUSH_TITLE") + if skipTitle: + if (title in re.split("\n", skipTitle)): + print(f"{title} 在SKIP_PUSH_TITLE环境变量内,跳过推送!") + return + hitokoto = push_config.get("HITOKOTO") text = one() if hitokoto else ""