MCPcopy Create free account
hub / github.com/6dylan6/jdm / BarkNotify

Function BarkNotify

function/sendNotify.js:1274–1314  ·  view source on GitHub ↗
(text, desp, params = {})

Source from the content-addressed store, hash-verified

1272}
1273
1274function BarkNotify(text, desp, params = {}) {
1275 return new Promise((resolve) => {
1276 if (BARK_PUSH) {
1277 const options = {
1278 url: `${BARK_PUSH}`,
1279 json: {
1280 title: text,
1281 body: desp,
1282 group: `${BARK_GROUP}`,
1283 //icon: `${BARK_ICON}`,
1284 sound: `${BARK_SOUND}`,
1285 },
1286 headers: {
1287 'Content-Type': 'application/json; charset=utf-8',
1288 },
1289 timeout,
1290 };
1291 $.post(options, (err, resp, data) => {
1292 try {
1293 if (err) {
1294 console.log('Bark APP发送通知调用API失败!!\n');
1295 console.log(err);
1296 } else {
1297 data = JSON.parse(data);
1298 if (data.code === 200) {
1299 console.log('Bark APP发送通知消息成功🎉\n');
1300 } else {
1301 console.log(`${data.message}\n`);
1302 }
1303 }
1304 } catch (e) {
1305 $.logErr(e, resp);
1306 } finally {
1307 resolve();
1308 }
1309 });
1310 } else {
1311 resolve();
1312 }
1313 });
1314}
1315
1316function tgBotNotify(text, desp) {
1317 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