MCPcopy Create free account
hub / github.com/Semporia/Scripts / BarkNotify

Function BarkNotify

sendNotify.js:262–296  ·  view source on GitHub ↗
(text, desp, params = {})

Source from the content-addressed store, hash-verified

260}
261
262function BarkNotify(text, desp, params = {}) {
263 return new Promise(resolve => {
264 if (BARK_PUSH) {
265 const options = {
266 url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&${querystring.stringify(params)}`,
267 headers: {
268 'Content-Type': 'application/x-www-form-urlencoded'
269 },
270 timeout
271 }
272 $.get(options, (err, resp, data) => {
273 try {
274 if (err) {
275 console.log('Bark APP发送通知调用API失败!!\n')
276 console.log(err);
277 } else {
278 data = JSON.parse(data);
279 if (data.code === 200) {
280 console.log('Bark APP发送通知消息成功🎉\n')
281 } else {
282 console.log(`${data.message}\n`);
283 }
284 }
285 } catch (e) {
286 $.logErr(e, resp);
287 } finally {
288 resolve();
289 }
290 })
291 } else {
292 console.log('您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知🚫\n');
293 resolve()
294 }
295 })
296}
297
298function tgBotNotify(text, desp) {
299 return new Promise(resolve => {

Callers 1

sendNotifyFunction · 0.85

Calls 3

getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected