forked from Wenmoux/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmt_sign.js
43 lines (40 loc) · 1.46 KB
/
mt_sign.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
//mt论坛每日签到 https://bbs.binmt.cc/?fromuid=14593
const axios = require("axios");
function mt() {
return new Promise(async (resolve) => {
try {
let cookie = config.mt.cookie || "wenmoux";
let header = {
headers: {
cookie: cookie,
"Referer":"https://bbs.binmt.cc/member.php?mod=logging&action=login&mobile=2"
}
};
res = await axios.get("https://bbs.binmt.cc/k_misign-sign.html", header);
let formhash = res.data.match(/formhash=(.+?)&/);
if (formhash && !res.data.match(/登录/)) {
let signurl = `https://bbs.binmt.cc/k_misign-sign.html?operation=qiandao&format=button&formhash=${formhash[1]}&inajax=1&ajaxtarget=midaben_sign`;
res2 = await axios.get(signurl, header);
if (res2.data.match(/今日已签/)) {
msg = "今天已经签到过啦";
} else if (res2.data.match(/签到成功/)) {
msg1 = res2.data.match(/获得随机奖励.+?金币/);
msg2 = res2.data.match(/已累计签到 \d+ 天/);
msg = "签到成功\n" + msg1 + "\n" + msg2;
} else {
msg = "签到失败!原因未知";
console.log(res2.data);
}
} else {
msg = "cookie失效";
}
console.log(msg);
} catch (err) {
console.log(err);
msg = "签到接口请求出错";
}
resolve("【MT论坛】: " + msg);
});
}
//mt()
module.exports = mt;