This commit is contained in:
Faker
2022-05-17 11:11:34 +08:00
parent f3dac18672
commit 51eaf50a23
14 changed files with 1981 additions and 8 deletions

View File

@@ -14,7 +14,7 @@ const querystring = require('querystring');
const exec = require('child_process').exec;
const $ = new Env();
const timeout = 15000; //超时时间(单位毫秒)
console.log("加载sendNotify当前版本: 20220504");
console.log("加载sendNotify当前版本: 20220517");
// =======================================go-cqhttp通知设置区域===========================================
//gobot_url 填写请求地址http://127.0.0.1/send_private_msg
//gobot_token 填写在go-cqhttp文件设置的访问密钥
@@ -246,6 +246,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
var Use_WxPusher = true;
var strtext = text;
var strdesp = desp;
var titleIndex =-1;
if (process.env.NOTIFY_NOCKFALSE) {
Notify_NoCKFalse = process.env.NOTIFY_NOCKFALSE;
}
@@ -403,13 +404,14 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
return;
}
}
if (strtext.indexOf("cookie已失效") != -1 || strdesp.indexOf("重新登录获取") != -1 || strtext == "Ninja 运行通知") {
if (Notify_NoCKFalse == "true" && text != "Ninja 运行通知") {
console.log(`检测到NOTIFY_NOCKFALSE变量为true,不发送ck失效通知...`);
return;
}
}
if (text.indexOf("已可领取") != -1) {
if (text.indexOf("农场") != -1) {
strTitle = "东东农场领取";
@@ -430,6 +432,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
if (text.indexOf("任务") != -1 && (text.indexOf("新增") != -1 || text.indexOf("删除") != -1)) {
strTitle = "脚本任务更新";
}
if (strTitle) {
const notifyRemindList = process.env.NOTIFY_NOREMIND ? process.env.NOTIFY_NOREMIND.split('&') : [];
titleIndex = notifyRemindList.findIndex((item) => item === strTitle);
@@ -442,7 +445,6 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
} else {
strTitle = text;
}
if (Notify_NoLoginSuccess == "true") {
if (desp.indexOf("登陆成功") != -1) {
console.log(`登陆成功不推送`);
@@ -463,7 +465,7 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
//检查黑名单屏蔽通知
const notifySkipList = process.env.NOTIFY_SKIP_LIST ? process.env.NOTIFY_SKIP_LIST.split('&') : [];
let titleIndex = notifySkipList.findIndex((item) => item === strTitle);
titleIndex = notifySkipList.findIndex((item) => item === strTitle);
if (titleIndex !== -1) {
console.log(`${strTitle} 在推送黑名单中,已跳过推送`);
@@ -1457,7 +1459,10 @@ async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By cc
if(envs[i].created)
Tempinfo=getQLinfo(cookie, envs[i].created, envs[i].timestamp, envs[i].remarks);
else
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].timestamp, envs[i].remarks);
if(envs[i].updatedAt)
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].updatedAt, envs[i].remarks);
else
Tempinfo=getQLinfo(cookie, envs[i].createdAt, envs[i].timestamp, envs[i].remarks);
if (Tempinfo) {
$.Remark += Tempinfo;
}
@@ -1715,7 +1720,10 @@ async function sendNotifybyWxPucher(text, desp, PtPin, author = '\n\n本通知 B
if(tempEnv.created)
Tempinfo=getQLinfo(cookie, tempEnv.created, tempEnv.timestamp, tempEnv.remarks);
else
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.timestamp, tempEnv.remarks);
if(tempEnv.updatedAt)
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.updatedAt, tempEnv.remarks);
else
Tempinfo=getQLinfo(cookie, tempEnv.createdAt, tempEnv.timestamp, tempEnv.remarks);
if (Tempinfo) {
Tempinfo = $.nickName + Tempinfo;