MCPcopy Create free account
hub / github.com/Toulu-debug/enen / qywxBotNotify

Function qywxBotNotify

sendNotify.js:515–555  ·  view source on GitHub ↗
(text, desp)

Source from the content-addressed store, hash-verified

513}
514
515function qywxBotNotify(text, desp) {
516 return new Promise(resolve => {
517 const options = {
518 url: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${QYWX_KEY}`,
519 json: {
520 msgtype: 'text',
521 text: {
522 content: ` ${text}\n\n${desp}`,
523 },
524 },
525 headers: {
526 'Content-Type': 'application/json',
527 },
528 timeout
529 };
530 if (QYWX_KEY) {
531 $.post(options, (err, resp, data) => {
532 try {
533 if (err) {
534 console.log('企业微信发送通知消息失败!!\n');
535 console.log(err);
536 } else {
537 data = JSON.parse(data);
538 if (data.errcode === 0) {
539 console.log('企业微信发送通知消息成功🎉。\n');
540 } else {
541 console.log(`${data.errmsg}\n`);
542 }
543 }
544 } catch (e) {
545 $.logErr(e, resp);
546 } finally {
547 resolve(data);
548 }
549 });
550 } else {
551 // console.log('您未提供企业微信机器人推送所需的QYWX_KEY,取消企业微信推送消息通知🚫\n');
552 resolve();
553 }
554 });
555}
556
557function ChangeUserId(desp) {
558 const QYWX_AM_AY = QYWX_AM.split(',');

Callers 1

sendNotifyFunction · 0.85

Calls 3

postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected