(text, desp, params = {})
| 1272 | } |
| 1273 | |
| 1274 | function 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 | |
| 1316 | function tgBotNotify(text, desp) { |
| 1317 | return new Promise(resolve => { |
no test coverage detected