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

Function iGotNotify

sendNotify.js:686–728  ·  view source on GitHub ↗
(text, desp, params = {})

Source from the content-addressed store, hash-verified

684}
685
686function iGotNotify(text, desp, params = {}) {
687 return new Promise(resolve => {
688 if (IGOT_PUSH_KEY) {
689 // 校验传入的IGOT_PUSH_KEY是否有效
690 const IGOT_PUSH_KEY_REGX = new RegExp("^[a-zA-Z0-9]{24}$")
691 if (!IGOT_PUSH_KEY_REGX.test(IGOT_PUSH_KEY)) {
692 console.log('您所提供的IGOT_PUSH_KEY无效\n')
693 resolve()
694 return
695 }
696 const options = {
697 url: `https://push.hellyw.com/${IGOT_PUSH_KEY.toLowerCase()}`,
698 body: `title=${text}&content=${desp}&${querystring.stringify(params)}`,
699 headers: {
700 'Content-Type': 'application/x-www-form-urlencoded'
701 },
702 timeout
703 }
704 $.post(options, (err, resp, data) => {
705 try {
706 if (err) {
707 console.log('发送通知调用API失败!!\n')
708 console.log(err);
709 } else {
710 if (typeof data === 'string') data = JSON.parse(data);
711 if (data.ret === 0) {
712 console.log('iGot发送通知消息成功🎉\n')
713 } else {
714 console.log(`iGot发送通知消息失败:${data.errMsg}\n`)
715 }
716 }
717 } catch (e) {
718 $.logErr(e, resp);
719 } finally {
720 resolve(data);
721 }
722 })
723 } else {
724 // console.log('您未提供iGot的推送IGOT_PUSH_KEY,取消iGot推送消息通知🚫\n');
725 resolve()
726 }
727 })
728}
729
730function pushPlusNotify(text, desp) {
731 return new Promise(resolve => {

Callers 1

sendNotifyFunction · 0.85

Calls 3

logMethod · 0.45
postMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected