From bc8b768d5458397bf285b37c2acbfba51482cfd3 Mon Sep 17 00:00:00 2001 From: Faker Date: Wed, 6 Apr 2022 18:08:07 +0800 Subject: [PATCH] Update sendNotify.js --- sendNotify.js | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/sendNotify.js b/sendNotify.js index 7602278..7bd13bd 100644 --- a/sendNotify.js +++ b/sendNotify.js @@ -1,30 +1,13 @@ /* + * @Author: lxk0301 https://gitee.com/lxk0301 + * @Date: 2020-08-19 16:12:40 + * @Last Modified by: whyour + * @Last Modified time: 2021-5-1 15:00:54 * sendNotify 推送通知功能 * @param text 通知头 * @param desp 通知体 * @param params 某些推送通知方式点击弹窗可跳转, 例:{ url: 'https://abc.com' } * @param author 作者仓库等信息 例:`本通知 By:https://github.com/whyour/qinglong` - 部分变量设置 -## 拆分通知 -export BEANCHANGE_PERSENT="10" -## 如果通知标题在此变量里面存在(&隔开),则用屏蔽不发送通知 -export NOTIFY_SKIP_LIST="京东CK检测&京东资产变动" -## 当接收到发送CK失效通知和Ninja 运行通知时候执行子线程任务 -export NOTIFY_CKTASK="jd_CheckCK.js" -## 如果此变量(&隔开)的关键字在通知内容里面存在,则屏蔽不发送通知. -export NOTIFY_SKIP_TEXT="忘了种植&异常" -## 屏蔽任务脚本的ck失效通知 -export NOTIFY_NOCKFALSE="true" -## 服务器空数据等错误不触发通知 -export CKNOWARNERROR="true" -## 屏蔽青龙登陆成功通知,登陆失败不屏蔽 -export NOTIFY_NOLOGINSUCCESS="true" -## 通知底部显示 -export NOTIFY_AUTHOR="来源于:https://github.com/KingRan/KR" -## 增加NOTIFY_AUTHOR_BLANK 环境变量,控制不显示底部信息 -export NOTIFY_AUTHOR_BLANK="true" -## 增加NOTIFY_AUTOCHECKCK为true才开启通知脚本内置的自动禁用过期ck -export NOTIFY_AUTOCHECKCK=“true” */ //详细说明参考 https://github.com/ccwav/QLScript2. const querystring = require('querystring'); @@ -200,9 +183,10 @@ if (process.env.NOTIFY_SHOWNAMETYPE) { if (ShowRemarkType == "4") console.log("检测到显示备注名称,格式为: 备注"); } -async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By https://github.com/KingRan/KR',strsummary="") { - console.log(`开始发送通知...`); - +async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ccwav Mod', strsummary = "") { + console.log(`开始发送通知...`); + + //NOTIFY_FILTERBYFILE代码来自Ca11back. if (process.env.NOTIFY_FILTERBYFILE) { var no_notify = process.env.NOTIFY_FILTERBYFILE.split('&'); if (module.parent.filename) { @@ -218,6 +202,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht } } } + try { //Reset 变量 UseGroupNotify = 1; @@ -420,7 +405,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht } if (strtext.indexOf("cookie已失效") != -1 || strdesp.indexOf("重新登录获取") != -1 || strtext == "Ninja 运行通知") { if (Notify_NoCKFalse == "true" && text != "Ninja 运行通知") { - console.log(`检测到NOTIFY_NOCKFALSE变量为true,不发送ck失效通知...`); + console.log(`检测到NOTIFY_NOCKFALSE变量为true,不发送ck失效通知...`); return; } } @@ -1390,7 +1375,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht } if (allCode) { - desp += '\n' + '\n' + "格式化后的互助码:" + '\n' + allCode; + desp += '\n' + '\n' + "ccwav格式化后的互助码:" + '\n' + allCode; } } } @@ -1477,6 +1462,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht $.Remark += Tempinfo; } } + desp = desp.replace(new RegExp(`${$.UserName}|${$.nickName}`, 'gm'), $.Remark); strsummary = strsummary.replace(new RegExp(`${$.UserName}|${$.nickName}`, 'gm'), $.Remark); //额外处理2,nickName不包含星号,但是确实是手机号 @@ -1486,7 +1472,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht //console.log("额外处理2:"+tempname); text = text.replace(new RegExp(tempname, 'gm'), $.Remark); desp = desp.replace(new RegExp(tempname, 'gm'), $.Remark); - strsummary = strsummary.replace(new RegExp(tempname, 'gm'), $.Remark); + strsummary = strsummary.replace(new RegExp(tempname, 'gm'), $.Remark); } } catch (err) { @@ -1505,7 +1491,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht } console.log("处理完成,开始发送通知..."); if (strAllNotify) { - desp = strAllNotify+"\n" + desp; + desp = strAllNotify + "\n" + desp; } } } catch (error) { @@ -1570,7 +1556,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ht tgBotNotify(text, desp), //telegram 机器人 ddBotNotify(text, desp), //钉钉机器人 qywxBotNotify(text, desp), //企业微信机器人 - qywxamNotify(text, desp,strsummary), //企业微信应用消息推送 + qywxamNotify(text, desp, strsummary), //企业微信应用消息推送 iGotNotify(text, desp, params), //iGot gobotNotify(text, desp), //go-cqhttp gotifyNotify(text, desp), //gotify @@ -1583,7 +1569,7 @@ function getuuid(strRemark, PtPin) { if (strRemark) { var Tempindex = strRemark.indexOf("@@"); if (Tempindex != -1) { - console.log(PtPin+": 检测到NVJDC的一对一格式,瑞思拜~!"); + console.log(PtPin + ": 检测到NVJDC的一对一格式,瑞思拜~!"); var TempRemarkList = strRemark.split("@@"); for (let j = 1; j < TempRemarkList.length; j++) { if (TempRemarkList[j]) { @@ -1647,7 +1633,6 @@ function getQLinfo(strCK, intcreated, strTimestamp, strRemark) { } } - return strReturn }