根据标题跳过消息推送,环境变量:SKIP_PUSH_TITLE 用回车分隔 (#1833)

This commit is contained in:
pharaoh2012 2023-03-03 21:59:44 +08:00 committed by GitHub
parent d342fbf29f
commit 2ff3d9c601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -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(推送加)

View File

@ -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 ""