MCPcopy Create free account
hub / github.com/6dylan6/jdpro / qywxBotNotify

Function qywxBotNotify

function/sendNotify.js:1440–1480  ·  view source on GitHub ↗
(text, desp)

Source from the content-addressed store, hash-verified

1438}
1439
1440function qywxBotNotify(text, desp) {
1441 return new Promise((resolve) => {
1442 const options = {
1443 url: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${QYWX_KEY}`,
1444 json: {
1445 msgtype: 'text',
1446 text: {
1447 content: ` ${text}\n\n${desp}`,
1448 },
1449 },
1450 headers: {
1451 'Content-Type': 'application/json',
1452 },
1453 timeout,
1454 };
1455 if (QYWX_KEY) {
1456 $.post(options, (err, resp, data) => {
1457 try {
1458 if (err) {
1459 console.log('企业微信发送通知消息失败!!\n');
1460 console.log(err);
1461 } else {
1462 data = JSON.parse(data);
1463 if (data.errcode === 0) {
1464 console.log('企业微信发送通知消息成功🎉。\n');
1465 } else {
1466 console.log(`${data.errmsg}\n`);
1467 }
1468 }
1469 } catch (e) {
1470 $.logErr(e, resp);
1471 }
1472 finally {
1473 resolve(data);
1474 }
1475 });
1476 } else {
1477 resolve();
1478 }
1479 });
1480}
1481
1482function fsBotNotify(text, desp) {
1483 return new Promise((resolve) => {

Callers 1

sendNotifyFunction · 0.70

Calls 3

postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected