(text, desp, params = {})
| 353 | } |
| 354 | |
| 355 | function BarkNotify(text, desp, params = {}) { |
| 356 | return new Promise(resolve => { |
| 357 | if (BARK_PUSH) { |
| 358 | const options = { |
| 359 | url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&group=${BARK_GROUP}&${querystring.stringify(params)}`, |
| 360 | headers: { |
| 361 | 'Content-Type': 'application/x-www-form-urlencoded' |
| 362 | }, |
| 363 | timeout |
| 364 | } |
| 365 | $.get(options, (err, resp, data) => { |
| 366 | try { |
| 367 | if (err) { |
| 368 | console.log('Bark APP发送通知调用API失败!!\n') |
| 369 | console.log(err); |
| 370 | } else { |
| 371 | data = JSON.parse(data); |
| 372 | if (data.code === 200) { |
| 373 | console.log('Bark APP发送通知消息成功🎉\n') |
| 374 | } else { |
| 375 | console.log(`${data.message}\n`); |
| 376 | } |
| 377 | } |
| 378 | } catch (e) { |
| 379 | $.logErr(e, resp); |
| 380 | } finally { |
| 381 | resolve(); |
| 382 | } |
| 383 | }) |
| 384 | } else { |
| 385 | // console.log('您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知🚫\n'); |
| 386 | resolve() |
| 387 | } |
| 388 | }) |
| 389 | } |
| 390 | |
| 391 | function tgBotNotify(text, desp) { |
| 392 | return new Promise(resolve => { |
no test coverage detected