MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / qywxBotNotify

Function qywxBotNotify

tools/sendNotify.js:585–623  ·  view source on GitHub ↗
(text, desp)

Source from the content-addressed store, hash-verified

583}
584
585function qywxBotNotify(text, desp) {
586 return new Promise((resolve) => {
587 const { QYWX_ORIGIN, QYWX_KEY } = push_config;
588 const options = {
589 url: `${QYWX_ORIGIN}/cgi-bin/webhook/send?key=${QYWX_KEY}`,
590 json: {
591 msgtype: 'text',
592 text: {
593 content: `${text}\n\n${desp}`,
594 },
595 },
596 headers: {
597 'Content-Type': 'application/json',
598 },
599 timeout,
600 };
601 if (QYWX_KEY) {
602 $.post(options, (err, resp, data) => {
603 try {
604 if (err) {
605 console.log('企业微信发送通知消息失败😞\n', err);
606 } else {
607 if (data.errcode === 0) {
608 console.log('企业微信发送通知消息成功🎉。\n');
609 } else {
610 console.log(`企业微信发送通知消息异常 ${data.errmsg}\n`);
611 }
612 }
613 } catch (e) {
614 $.logErr(e, resp);
615 } finally {
616 resolve(data);
617 }
618 });
619 } else {
620 resolve();
621 }
622 });
623}
624
625function ChangeUserId(desp) {
626 const { QYWX_AM } = push_config;

Callers 1

sendNotifyFunction · 0.70

Calls 3

postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected