MCPcopy Create free account
hub / github.com/Semporia/Scripts / qywxBotNotify

Function qywxBotNotify

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

Source from the content-addressed store, hash-verified

415}
416
417function qywxBotNotify(text, desp) {
418 return new Promise(resolve => {
419 const options = {
420 url: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${QYWX_KEY}`,
421 json: {
422 msgtype: 'text',
423 text: {
424 content: ` ${text}\n\n${desp}`,
425 },
426 },
427 headers: {
428 'Content-Type': 'application/json',
429 },
430 timeout
431 };
432 if (QYWX_KEY) {
433 $.post(options, (err, resp, data) => {
434 try {
435 if (err) {
436 console.log('企业微信发送通知消息失败!!\n');
437 console.log(err);
438 } else {
439 data = JSON.parse(data);
440 if (data.errcode === 0) {
441 console.log('企业微信发送通知消息成功🎉。\n');
442 } else {
443 console.log(`${data.errmsg}\n`);
444 }
445 }
446 } catch (e) {
447 $.logErr(e, resp);
448 } finally {
449 resolve(data);
450 }
451 });
452 } else {
453 console.log('您未提供企业微信机器人推送所需的QYWX_KEY,取消企业微信推送消息通知🚫\n');
454 resolve();
455 }
456 });
457}
458
459function ChangeUserId(desp) {
460 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