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

Function wePlusBotNotify

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

Source from the content-addressed store, hash-verified

879}
880
881function wePlusBotNotify(text, desp) {
882 return new Promise((resolve) => {
883 const { WE_PLUS_BOT_TOKEN, WE_PLUS_BOT_RECEIVER, WE_PLUS_BOT_VERSION } =
884 push_config;
885 if (WE_PLUS_BOT_TOKEN) {
886 let template = 'txt';
887 if (desp.length > 800) {
888 desp = desp.replace(/[\n\r]/g, '<br>');
889 template = 'html';
890 }
891 const body = {
892 token: `${WE_PLUS_BOT_TOKEN}`,
893 title: `${text}`,
894 content: `${desp}`,
895 template: `${template}`,
896 receiver: `${WE_PLUS_BOT_RECEIVER}`,
897 version: `${WE_PLUS_BOT_VERSION}`,
898 };
899 const options = {
900 url: `https://www.weplusbot.com/send`,
901 body: JSON.stringify(body),
902 headers: {
903 'Content-Type': ' application/json',
904 },
905 timeout,
906 };
907 $.post(options, (err, resp, data) => {
908 try {
909 if (err) {
910 console.log(`微加机器人发送通知消息失败😞\n`, err);
911 } else {
912 if (data.code === 200) {
913 console.log(`微加机器人发送通知消息完成🎉\n`);
914 } else {
915 console.log(`微加机器人发送通知消息异常 ${data.msg}\n`);
916 }
917 }
918 } catch (e) {
919 $.logErr(e, resp);
920 } finally {
921 resolve(data);
922 }
923 });
924 } else {
925 resolve();
926 }
927 });
928}
929
930function aibotkNotify(text, desp) {
931 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