forked from Wenmoux/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendmsg.js
79 lines (77 loc) · 2.33 KB
/
sendmsg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const sckey = "";
const qmsgkey = "";
const cpkey = "";
const $http = require("axios");
async function sendmsg(text) {
console.log(text)
await server(text);
await qmsg(text);
await cp(text);
}
function qmsg(msg) {
return new Promise(async (resolve) => {
try {
if (sckey) {
let url = `https://sctapi.ftqq.com/${sckey}.send`
let data =`title=${encodeURI("wps记得手动打卡哦")}&desp=${encodeURI(text)}`
let res = await axios.post(url,data)
if (res.data.code == 0) {
console.log("server酱:发送成功");
} else {
console.log("server酱:发送失败");
console.log(res.data.info);
}
} else {
console.log("server酱:你还没有填写qmsg酱推送key呢,推送个鸡腿");
}
} catch (err) {
console.log("Qmsg酱:发送接口调用失败");
console.log(err);
}
resolve();
});
}
function server(a) {
return new Promise(async (resolve) => {
try {
if (sckey) {
url = `https://sc.ftqq.com/${sckey}.send`;
res = await $http.post(url, `text=签到盒-每日任务已完成&desp=${a}`);
if (res.data.errmsg == "success") {
console.log("server酱:发送成功");
} else {
console.log("server酱:发送失败");
}
} else {
console.log("server酱:你还没有填写qmsg酱推送key呢,推送个鸡腿");
}
} catch (err) {
console.log("server酱:发送接口调用失败");
console.log(err);
}
resolve();
});
}
function cp(msg) {
return new Promise(async (resolve) => {
try {
if (qmsgkey) {
let url = `https://push.xuthus.cc/send/${cpkey}?c=${encodeURI(msg)}`;
let res = await $http.get(url);
if (res.data.code == 200) {
console.log("酷推:发送成功");
} else {
console.log(res.data);
console.log("酷推:发送失败!" + res.data.reason);
}
} else {
console.log("酷推:你还没有填写酷推推送key呢,推送个鸡腿");
}
} catch (err) {
console.log("酷推:发送接口调用失败");
console.log(err);
}
resolve();
});
}
module.exports=sendmsg