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

Function iGotNotify

sendNofity.js:773–813  ·  view source on GitHub ↗
(text, desp, params = {})

Source from the content-addressed store, hash-verified

771}
772
773function iGotNotify(text, desp, params = {}) {
774 return new Promise((resolve) => {
775 const { IGOT_PUSH_KEY } = push_config;
776 if (IGOT_PUSH_KEY) {
777 // 校验传入的IGOT_PUSH_KEY是否有效
778 const IGOT_PUSH_KEY_REGX = new RegExp('^[a-zA-Z0-9]{24}$');
779 if (!IGOT_PUSH_KEY_REGX.test(IGOT_PUSH_KEY)) {
780 console.log('您所提供的 IGOT_PUSH_KEY 无效\n');
781 resolve();
782 return;
783 }
784 const options = {
785 url: `https://push.hellyw.com/${IGOT_PUSH_KEY.toLowerCase()}`,
786 body: `title=${text}&content=${desp}&${querystring.stringify(params)}`,
787 headers: {
788 'Content-Type': 'application/x-www-form-urlencoded',
789 },
790 timeout,
791 };
792 $.post(options, (err, resp, data) => {
793 try {
794 if (err) {
795 console.log('IGot 发送通知调用API失败😞\n', err);
796 } else {
797 if (data.ret === 0) {
798 console.log('IGot 发送通知消息成功🎉\n');
799 } else {
800 console.log(`IGot 发送通知消息异常 ${data.errMsg}\n`);
801 }
802 }
803 } catch (e) {
804 $.logErr(e, resp);
805 } finally {
806 resolve(data);
807 }
808 });
809 } else {
810 resolve();
811 }
812 });
813}
814
815function pushPlusNotify(text, desp) {
816 return new Promise((resolve) => {

Callers 1

sendNotifyFunction · 0.70

Calls 3

logMethod · 0.45
postMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected