mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
修正部分问题
This commit is contained in:
parent
51ba81f6b0
commit
3f26e8f807
@ -285,7 +285,7 @@ async function dateTime_(time) {
|
|||||||
"深夜";
|
"深夜";
|
||||||
}
|
}
|
||||||
async function getDailyNote(uid, cookie) {
|
async function getDailyNote(uid, cookie) {
|
||||||
let mysApi = new MysApi(uid, cookie)
|
let mysApi = (await import(`file://${_path}/lib/app/mysApi.js`))
|
||||||
let {
|
let {
|
||||||
url,
|
url,
|
||||||
headers,
|
headers,
|
||||||
@ -294,8 +294,7 @@ async function getDailyNote(uid, cookie) {
|
|||||||
} = mysApi.getUrl("dailyNote", uid);
|
} = mysApi.getUrl("dailyNote", uid);
|
||||||
headers.Cookie = cookie;
|
headers.Cookie = cookie;
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: "get",
|
method: "get", headers
|
||||||
headers
|
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ export async function signTask(e){
|
|||||||
}
|
}
|
||||||
export async function cookiesDocHelp(e){
|
export async function cookiesDocHelp(e){
|
||||||
let user = new User(e);
|
let user = new User(e);
|
||||||
e.reply(`【${e.msg.replace(/帮助|教程|绑定/g,"")}帮助】${await user.docHelp(e.msg)}\ncookies必须包含login_ticket获取后请私发机器人`);
|
e.reply(`【${e.msg.replace(/帮助|教程|绑定/g,"")}帮助】${await user.docHelp(e.msg)}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
export async function seach(e){
|
export async function seach(e){
|
||||||
@ -82,8 +82,9 @@ export async function bbsSign(e) {
|
|||||||
START = moment().unix();
|
START = moment().unix();
|
||||||
let res = await user.bbsSeachSign()
|
let res = await user.bbsSeachSign()
|
||||||
if(res.isOk&&res?.data?.can_get_points!==0){
|
if(res.isOk&&res?.data?.can_get_points!==0){
|
||||||
let forumData = await user.getDataList(e.msg);
|
let msg=e.msg.replace(/(米游社|mys|社区|签到|#)/g,"")
|
||||||
e.reply(`开始尝试${e.msg}社区签到预计${e.msg=='全部'?"10-20":"1-3"}分钟~`)
|
let forumData = await user.getDataList(msg);
|
||||||
|
e.reply(`开始尝试${msg}社区签到预计${msg=='全部'?"10-20":"1-3"}分钟~`)
|
||||||
res=await user.getbbsSign(forumData)
|
res=await user.getbbsSign(forumData)
|
||||||
}
|
}
|
||||||
await replyMsg(e, res.message);
|
await replyMsg(e, res.message);
|
||||||
|
@ -13,21 +13,9 @@ import {
|
|||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
import mys from "./mysTool.js"
|
import mys from "./mysTool.js"
|
||||||
const _path = process.cwd();
|
const _path = process.cwd();
|
||||||
// const APP_VERSION = "2.37.1";
|
|
||||||
// const mhyVersion = "2.11.1";
|
|
||||||
// const salt = "6J1hde1Wu02eF1DFlLpMjeg2dMloAytL";
|
|
||||||
// const salt2 = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v";
|
|
||||||
// const saltWeb = "Qqx8cyv7kuyD8fTw11SmvXSFHp7iZD29";
|
|
||||||
// const oldsalt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
|
|
||||||
// const osSaltWeb = ''; //os 浏览帖子需要用到的salt
|
|
||||||
const DEVICE_ID = utils.randomString(32).toUpperCase();
|
const DEVICE_ID = utils.randomString(32).toUpperCase();
|
||||||
const DEVICE_NAME = utils.randomString(_.random(1, 10));
|
const DEVICE_NAME = utils.randomString(_.random(1, 10));
|
||||||
const yamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
const yamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
||||||
// const web_api = `https://api-takumi.mihoyo.com`
|
|
||||||
// const os_web_api = `https://api-os-takumi.mihoyo.com`
|
|
||||||
// const os_hk4_api = `https://hk4e-api-os.hoyoverse.com`;
|
|
||||||
// const hk4_api = `https://hk4e-api.mihoyo.com`;
|
|
||||||
// const bbs_api = `https://bbs-api.mihoyo.com`;
|
|
||||||
let HttpsProxyAgent = ''
|
let HttpsProxyAgent = ''
|
||||||
// 米游社的版块
|
// 米游社的版块
|
||||||
|
|
||||||
@ -109,8 +97,13 @@ export default class miHoYoApi {
|
|||||||
Bot.logger.error(`[接口][${type}][${this.e.uid}] ${response.status} ${response.statusText}`)
|
Bot.logger.error(`[接口][${type}][${this.e.uid}] ${response.status} ${response.statusText}`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
Bot.logger.mark(`[接口][${type}][${this.e.uid}] ${Date.now() - start}ms`)
|
// Bot.logger.mark(`[接口][${type}][${this.e.uid}] ${Date.now() - start}ms`)
|
||||||
const res = await response.json()
|
let res = await response.text();
|
||||||
|
if (res.startsWith('(')) {
|
||||||
|
res = JSON.parse((res).replace(/\(|\)/g, ""))
|
||||||
|
} else {
|
||||||
|
res = JSON.parse(res)
|
||||||
|
}
|
||||||
if (!res) {
|
if (!res) {
|
||||||
Bot.logger.mark('mys接口没有返回')
|
Bot.logger.mark('mys接口没有返回')
|
||||||
return false
|
return false
|
||||||
@ -145,16 +138,19 @@ export default class miHoYoApi {
|
|||||||
sign: true,
|
sign: true,
|
||||||
types: 'bbs'
|
types: 'bbs'
|
||||||
},
|
},
|
||||||
//人啊不能总想着跳脸 ~~这块给你们留个念想
|
|
||||||
bbsGetCaptcha: {
|
bbsGetCaptcha: {
|
||||||
url:`???????????????????????????????????????????????????`,
|
url: `${mys.bbs_api}/misc/api/createVerification`,
|
||||||
|
query: `is_high=true`,
|
||||||
|
types: 'bbs'
|
||||||
},
|
},
|
||||||
bbsValidate: {
|
bbsValidate: {
|
||||||
url:`???????????????????????????????????????????????????`,
|
url: `https://apiv6.geetest.com/ajax.php`,
|
||||||
|
query: `gt=${data.gt}&challenge=${data.challenge}&lang=zh-cn&pt=3&client_type=web_mobile`,
|
||||||
},
|
},
|
||||||
bbsCaptchaVerify: {
|
bbsCaptchaVerify: {
|
||||||
url:`???????????????????????????????????????????????????`
|
url: `${mys.bbs_api}/misc/api/verifyVerification`
|
||||||
},
|
},
|
||||||
|
//待定接口 用于获取用户米游社顶部的模块栏
|
||||||
bbs_Businesses_url: {
|
bbs_Businesses_url: {
|
||||||
url: `${mys.bbs_api}/user/api/getUserBusinesses`,
|
url: `${mys.bbs_api}/user/api/getUserBusinesses`,
|
||||||
query: `uid={}` //????
|
query: `uid={}` //????
|
||||||
|
@ -58,7 +58,6 @@ export default class user {
|
|||||||
}
|
}
|
||||||
let resSign = await this.multiSign(this.ForumData);
|
let resSign = await this.multiSign(this.ForumData);
|
||||||
if (resSign?.upData) {
|
if (resSign?.upData) {
|
||||||
// console.log(resSign?.upData)
|
|
||||||
for (let item of resSign?.upData) {
|
for (let item of resSign?.upData) {
|
||||||
let num = lodash.random(0, 9999);
|
let num = lodash.random(0, 9999);
|
||||||
item.upName = item.upName == "原神" ? "ys" : item.upName == "崩坏3" ? "bh3" : item.upName ==
|
item.upName = item.upName == "原神" ? "ys" : item.upName == "崩坏3" ? "bh3" : item.upName ==
|
||||||
@ -108,9 +107,22 @@ export default class user {
|
|||||||
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
|
message += `${item.nickname}-${item.game_uid}:今日已签到~\n`;
|
||||||
} else {
|
} else {
|
||||||
res = await this.getData("sign", data)
|
res = await this.getData("sign", data)
|
||||||
if (res?.data?.gt) {
|
if (res?.data?.gt) { //去除geetest
|
||||||
|
// let validate = await geetest(res.data)
|
||||||
|
// if (validate) {
|
||||||
|
// let header = {}
|
||||||
|
// header["x-rpc-challenge"] = res["data"]["challenge"]
|
||||||
|
// header["x-rpc-validate"] = validate
|
||||||
|
// header["x-rpc-seccode"] = `${validate}|jordan`
|
||||||
|
// data.headers = header
|
||||||
|
// res = await this.getData("sign", data)
|
||||||
|
// if (!res?.data?.gt) {
|
||||||
|
// message += `${item.nickname}-${item.game_uid}:验证码签到成功~`
|
||||||
|
// } else {
|
||||||
item.is_sign = false;
|
item.is_sign = false;
|
||||||
message += `${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
|
message += `${item.nickname}-${item.game_uid}:签到出现验证码~\n请晚点后重试,或者手动上米游社签到\n`;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
item.total_sign_day++;
|
item.total_sign_day++;
|
||||||
message +=
|
message +=
|
||||||
@ -169,6 +181,7 @@ export default class user {
|
|||||||
}
|
}
|
||||||
async getbbsSign(forumData) {
|
async getbbsSign(forumData) {
|
||||||
let message = '',
|
let message = '',
|
||||||
|
challenge = '',
|
||||||
res;
|
res;
|
||||||
try {
|
try {
|
||||||
if (bbsTask) {
|
if (bbsTask) {
|
||||||
@ -184,6 +197,13 @@ export default class user {
|
|||||||
res = await this.getData("bbsSign", forum)
|
res = await this.getData("bbsSign", forum)
|
||||||
if (res?.retcode == 1034) {
|
if (res?.retcode == 1034) {
|
||||||
message += `社区签到: 验证码失败\n`;
|
message += `社区签到: 验证码失败\n`;
|
||||||
|
challenge = await this.bbsGeetest()
|
||||||
|
if (challenge) {
|
||||||
|
forum["headers"] = {
|
||||||
|
"x-rpc-challenge": challenge
|
||||||
|
}
|
||||||
|
await this.getData("bbsSign", forum)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
message += `社区签到: ${res.message}\n`;
|
message += `社区签到: ${res.message}\n`;
|
||||||
}
|
}
|
||||||
@ -202,12 +222,30 @@ export default class user {
|
|||||||
if (res?.message && res?.retcode == 0) {
|
if (res?.message && res?.retcode == 0) {
|
||||||
trueDetail++;
|
trueDetail++;
|
||||||
}
|
}
|
||||||
|
if (res?.retcode == 1034) {
|
||||||
|
challenge = await this.bbsGeetest()
|
||||||
|
if (challenge) {
|
||||||
|
forum["headers"] = {
|
||||||
|
"x-rpc-challenge": challenge
|
||||||
|
}
|
||||||
|
await this.getData("bbsSign", forum)
|
||||||
|
}
|
||||||
|
}
|
||||||
res = await this.getData("bbsVotePost", {
|
res = await this.getData("bbsVotePost", {
|
||||||
postId
|
postId
|
||||||
})
|
})
|
||||||
if (res?.message && res?.retcode == 0) {
|
if (res?.message && res?.retcode == 0) {
|
||||||
Vote++;
|
Vote++;
|
||||||
}
|
}
|
||||||
|
if (res?.retcode == 1034) {
|
||||||
|
challenge = await this.bbsGeetest()
|
||||||
|
if (challenge) {
|
||||||
|
forum["headers"] = {
|
||||||
|
"x-rpc-challenge": challenge
|
||||||
|
}
|
||||||
|
await this.getData("bbsSign", forum)
|
||||||
|
}
|
||||||
|
}
|
||||||
await utils.randomSleepAsync(2);
|
await utils.randomSleepAsync(2);
|
||||||
}
|
}
|
||||||
let sharePost = postList[0].post;
|
let sharePost = postList[0].post;
|
||||||
@ -449,6 +487,28 @@ export default class user {
|
|||||||
}
|
}
|
||||||
async bbsGeetest() {
|
async bbsGeetest() {
|
||||||
let res = await this.getData('bbsGetCaptcha') //?????????????????????????????
|
let res = await this.getData('bbsGetCaptcha') //?????????????????????????????
|
||||||
|
let challenge = res.data["challenge"]
|
||||||
|
res = await this.getData("bbsValidate", res.data)
|
||||||
|
if (res?.data?.validate) {
|
||||||
|
let validate = res?.data?.validate
|
||||||
|
res = await this.getData("bbsCaptchaVerify", {
|
||||||
|
headers: {
|
||||||
|
"geetest_challenge": challenge,
|
||||||
|
"geetest_seccode": validate + "|jordan",
|
||||||
|
"geetest_validate": validate
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return res["data"]["challenge"]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
async geetest(data) {
|
||||||
|
let res = await this.getData("validate", data)
|
||||||
|
if (res?.data?.validate) {
|
||||||
|
let validate = res?.data?.validate
|
||||||
|
return validate
|
||||||
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
getyunToken(e) {
|
getyunToken(e) {
|
||||||
let file = `${this.yunPath}${e.user_id}.yaml`
|
let file = `${this.yunPath}${e.user_id}.yaml`
|
||||||
@ -482,8 +542,7 @@ export default class user {
|
|||||||
// e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
// e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// let flot = (await miHoYoApi.stoken(cookie, e));
|
let flot = this.stoken(cookie, e)
|
||||||
// console.log(flot)
|
|
||||||
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
||||||
if (!flot) {
|
if (!flot) {
|
||||||
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
||||||
|
Loading…
Reference in New Issue
Block a user