Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

佬能否加个可爱猫的微信机器人推送变量 #5

Closed
ilee593 opened this issue Mar 7, 2022 · 0 comments
Closed

佬能否加个可爱猫的微信机器人推送变量 #5

ilee593 opened this issue Mar 7, 2022 · 0 comments

Comments

@ilee593
Copy link

ilee593 commented Mar 7, 2022

原sendNotify.js
环境变量了设定export WX_BOT="http://10.10.19.222:12345"
参数如下
=======================================WXBOT=======================================
let WX_BOT = '';

await Promise.all([
BarkNotify(text, desp, params),//iOS Bark APP
tgBotNotify(text, desp),//telegram 机器人
ddBotNotify(text, desp),//钉钉机器人
qywxBotNotify(text, desp), //企业微信机器人
qywxamNotify(text, desp), //企业微信应用消息推送
iGotNotify(text, desp, params),//iGot
wxBOT(text, desp)//微信机器人
//CoolPush(text, desp)//QQ酷推
])
}
} else {
//console.log('\n没有环境变量,或变量值为空,该通知直接推送')
await Promise.all([
serverNotify(text, desp),//微信server酱
pushPlusNotify(text, desp)//pushplus(推送加)
])
text = text.match(/.?(?=\s?-)/g) ? text.match(/.?(?=\s?-)/g)[0] : text;
await Promise.all([
BarkNotify(text, desp, params),//iOS Bark APP
tgBotNotify(text, desp),//telegram 机器人
ddBotNotify(text, desp),//钉钉机器人
qywxBotNotify(text, desp), //企业微信机器人
qywxamNotify(text, desp), //企业微信应用消息推送
iGotNotify(text, desp, params),//iGot
wxBOT(text, desp)//微信机器人
//CoolPush(text, desp)//QQ酷推
])
}
} else if (unblock_ck != 'false' && (text.indexOf("cookie已失效") != -1 || desp.indexOf("请重新登录获取cookie") != -1)) {
unblocks = process.env.my_unblock ?? "";
let thereg = /.账号(\d+)./gm
ck_num = thereg.exec(desp)[1];
if (unblocks.split(",").indexOf(ck_num) != -1) {
console.log('\n该cookie的失效通知,允许推送');
await Promise.all([
serverNotify(text, desp),//微信server酱
pushPlusNotify(text, desp)//pushplus(推送加)
])
text = text.match(/.?(?=\s?-)/g) ? text.match(/.?(?=\s?-)/g)[0] : text;
await Promise.all([
BarkNotify(text, desp, params),//iOS Bark APP
tgBotNotify(text, desp),//telegram 机器人
ddBotNotify(text, desp),//钉钉机器人
qywxBotNotify(text, desp), //企业微信机器人
qywxamNotify(text, desp), //企业微信应用消息推送
iGotNotify(text, desp, params),//iGot
wxBOT(text, desp)//微信机器人
//CoolPush(text, desp)//QQ酷推
])
}else{
console.log('\n该cookie的失效通知,不进行推送');
}
}
}

function wxBOT(text, desp) {
return new Promise(resolve => {
const options = {
url: ${WX_BOT},
json: {
boby: {
text: ${text},
content: ${desp},
},
},
headers: {
'Content-Type': 'application/json',
},
timeout
};
if (WX_BOT) {
$.post(options, (err, resp, data) => {
try {
if (err) {
console.log('微信机器人发送通知消息失败!!\n');
console.log(err);
} else {
data = JSON.parse(data);
if (data.errcode === 0) {
console.log('\n\n微信机器人发送通知消息成功🎉。\n');
} else {
// console.log(${data.errmsg}\n);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
});
} else {
// console.log('您未提供微信机器人推送所需的环境变量,取消微信机器人推送消息通知🚫\n');
resolve();
}
});
}

谢谢佬

@qitoqito qitoqito closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants