2022-08-16 23:24:54 +08:00
|
|
|
|
import utils from '../model/mys/utils.js';
|
|
|
|
|
import {
|
|
|
|
|
Cfg,
|
|
|
|
|
Data
|
|
|
|
|
} from "../components/index.js";
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import Common from "../components/Common.js";
|
|
|
|
|
import {
|
|
|
|
|
isV3
|
|
|
|
|
} from '../components/Changelog.js';
|
|
|
|
|
import gsCfg from '../model/gsCfg.js';
|
|
|
|
|
import fs from "fs";
|
|
|
|
|
import YAML from 'yaml'
|
|
|
|
|
import User from "../model/user.js"
|
2022-09-07 00:47:12 +08:00
|
|
|
|
|
2022-08-16 23:24:54 +08:00
|
|
|
|
export const rule = {
|
|
|
|
|
userInfo: {
|
|
|
|
|
reg: "^#*(ck|stoken|cookie|cookies|签到)查询$",
|
|
|
|
|
describe: "用户个人信息查询"
|
|
|
|
|
},
|
2022-08-31 23:26:24 +08:00
|
|
|
|
gclog: {
|
2022-10-04 21:41:07 +08:00
|
|
|
|
reg: "^#*(更新|获取|导出)抽卡记录$",
|
2022-08-31 23:26:24 +08:00
|
|
|
|
describe: "更新抽卡记录"
|
2022-09-05 11:49:06 +08:00
|
|
|
|
},
|
2022-11-19 15:11:56 +08:00
|
|
|
|
gcPaylog: { //避免指令冲突
|
|
|
|
|
reg: "^#*(刷新|获取|导出)(充值|氪金)记录$",
|
|
|
|
|
describe: "刷新充值记录"
|
|
|
|
|
},
|
2022-09-05 11:49:06 +08:00
|
|
|
|
mytoken: {
|
|
|
|
|
reg: "^#*我的(stoken|云ck)$",
|
|
|
|
|
describe: "查询绑定数据"
|
|
|
|
|
},
|
|
|
|
|
bindStoken: {
|
|
|
|
|
reg: "^(.*)stoken=(.*)$",
|
|
|
|
|
describe: "绑定stoken"
|
|
|
|
|
},
|
2022-10-31 21:15:24 +08:00
|
|
|
|
bindLogin_ticket: {
|
|
|
|
|
reg: "^(.*)login_ticket=(.*)$",
|
|
|
|
|
describe: "绑定ck自动获取sk"
|
|
|
|
|
},
|
2022-10-12 16:51:51 +08:00
|
|
|
|
cloudToken: {
|
|
|
|
|
reg: "^(.*)ct(.*)$",
|
|
|
|
|
describe: "云原神签到token获取"
|
|
|
|
|
},
|
2022-09-07 00:13:14 +08:00
|
|
|
|
delSign: {
|
2023-07-11 11:53:48 +08:00
|
|
|
|
reg: "^#*删除(我的)*((stoken|sk)|(云原神|云ck))$",
|
2022-09-05 11:49:06 +08:00
|
|
|
|
describe: "删除云原神、stoken数据"
|
|
|
|
|
},
|
2022-09-07 00:13:14 +08:00
|
|
|
|
updCookie: {
|
2022-10-04 21:41:07 +08:00
|
|
|
|
reg: "^#*(刷新|更新|获取)(ck|cookie)$",
|
2022-09-07 00:13:14 +08:00
|
|
|
|
describe: "刷新cookie"
|
2022-09-06 23:09:04 +08:00
|
|
|
|
}
|
2022-08-16 23:24:54 +08:00
|
|
|
|
}
|
2022-08-31 23:26:24 +08:00
|
|
|
|
const _path = process.cwd();
|
2022-09-05 11:49:06 +08:00
|
|
|
|
const YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
2022-09-07 00:13:14 +08:00
|
|
|
|
const yunpath = `${_path}/plugins/xiaoyao-cvs-plugin/data/yunToken/`;
|
2022-08-31 23:26:24 +08:00
|
|
|
|
export async function userInfo(e, {
|
|
|
|
|
render
|
|
|
|
|
}) {
|
|
|
|
|
let user = new User(e);
|
2022-08-16 23:24:54 +08:00
|
|
|
|
e.reply("正在获取角色信息请稍等...")
|
2022-08-31 23:26:24 +08:00
|
|
|
|
let sumData = await user.getCkData()
|
2022-08-16 23:24:54 +08:00
|
|
|
|
let week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
|
|
|
|
let day = moment(new Date()).format("yyyy年MM月DD日 HH:mm") + " " + week[new Date().getDay()];
|
2022-08-31 23:26:24 +08:00
|
|
|
|
if (Object.keys(sumData).length == 0) {
|
2022-10-12 16:51:51 +08:00
|
|
|
|
e.reply("未获取到角色信息~")
|
2022-08-16 23:44:24 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-31 23:26:24 +08:00
|
|
|
|
let ck = "";
|
|
|
|
|
if (e.cookie) {
|
2022-09-07 00:13:14 +08:00
|
|
|
|
ck = await utils.getCookieMap(e.cookie);
|
2022-09-05 13:47:48 +08:00
|
|
|
|
ck = ck?.get("ltuid")
|
2022-08-16 23:44:24 +08:00
|
|
|
|
}
|
2022-08-16 23:24:54 +08:00
|
|
|
|
return await Common.render(`user/userInfo`, {
|
|
|
|
|
uid: e.user_id,
|
2022-08-31 23:26:24 +08:00
|
|
|
|
ltuid: ck || e.user_id,
|
|
|
|
|
save_id: e.user_id,
|
2022-08-16 23:24:54 +08:00
|
|
|
|
day,
|
|
|
|
|
sumData
|
|
|
|
|
}, {
|
|
|
|
|
e,
|
|
|
|
|
render,
|
|
|
|
|
scale: 1.2
|
|
|
|
|
})
|
2022-08-31 23:26:24 +08:00
|
|
|
|
}
|
2022-09-05 11:49:06 +08:00
|
|
|
|
let configData = gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config");
|
2022-12-03 23:52:06 +08:00
|
|
|
|
export async function gcPaylog(e) {
|
2022-11-19 15:11:56 +08:00
|
|
|
|
let user = new User(e);
|
|
|
|
|
await user.cookie(e)
|
|
|
|
|
let redis_Data = await redis.get(`xiaoyao:gcPaylog:${e.user_id}`);
|
|
|
|
|
if (redis_Data) {
|
|
|
|
|
let time = redis_Data * 1 - Math.floor(Date.now() / 1000);
|
|
|
|
|
e.reply(`请求过快,请${time}秒后重试...`);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let isGet = /导出|获取/.test(e.msg)
|
|
|
|
|
if (!e.isPrivate && isGet) {
|
2022-11-19 15:11:56 +08:00
|
|
|
|
e.reply("请私聊发送")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-07-11 11:53:48 +08:00
|
|
|
|
let authkey = await getAuthKey(e, user,{auth_appid:'csc'})
|
2022-12-03 23:52:06 +08:00
|
|
|
|
if (!authkey) {
|
2022-11-19 15:11:56 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-07-11 11:53:48 +08:00
|
|
|
|
let url = `https://webstatic.mihoyo.com/event/user-game-search/hk4e/index.html?selfquery_type=3&lang=zh-cn&sign_type=2&auth_appid=csc&authkey_ver=1&authkey=${encodeURIComponent(authkey)}&game_biz=hk4e_cn&app_client=bbs&type=3&size=6®ion=${e.region}&end_id=`
|
2022-11-19 15:11:56 +08:00
|
|
|
|
e.msg = url
|
|
|
|
|
// e.reply(e.msg)
|
|
|
|
|
let sendMsg = [];
|
|
|
|
|
e.reply("充值记录获取中请稍等...")
|
|
|
|
|
e._reply = e.reply;
|
|
|
|
|
e.reply = (msg) => {
|
|
|
|
|
sendMsg.push(msg)
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
if (isGet) {
|
|
|
|
|
sendMsg = [...sendMsg, ...[1, `uid:${e.uid}`, e.msg]]
|
|
|
|
|
} else {
|
2022-11-19 15:11:56 +08:00
|
|
|
|
let time = (configData.gclogEx || 5) * 60
|
|
|
|
|
redis.set(`xiaoyao:gcPaylog:${e.user_id}`, Math.floor(Date.now() / 1000) + time, { //数据写入缓存避免重复请求
|
|
|
|
|
EX: time
|
|
|
|
|
});
|
|
|
|
|
if (isV3) {
|
2023-04-14 21:28:35 +08:00
|
|
|
|
let { payLog } = (await import(`file://${_path}/plugins/genshin/apps/payLog.js`))
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let pl = (new payLog())
|
|
|
|
|
e.isGroup = false;
|
|
|
|
|
pl.e = e
|
2022-11-19 15:11:56 +08:00
|
|
|
|
await pl.getAuthKey(e)
|
|
|
|
|
e._reply(sendMsg[1]);
|
|
|
|
|
return true;
|
|
|
|
|
// await (new payLog()).payLog(e)
|
|
|
|
|
} else {
|
|
|
|
|
e._reply(`V2暂不支持`);
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
await utils.replyMake(e, sendMsg, 1)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-31 23:26:24 +08:00
|
|
|
|
export async function gclog(e) {
|
|
|
|
|
let user = new User(e);
|
|
|
|
|
await user.cookie(e)
|
2022-09-01 09:55:26 +08:00
|
|
|
|
let redis_Data = await redis.get(`xiaoyao:gclog:${e.user_id}`);
|
2022-09-05 11:49:06 +08:00
|
|
|
|
if (redis_Data) {
|
|
|
|
|
let time = redis_Data * 1 - Math.floor(Date.now() / 1000);
|
2022-09-01 09:55:26 +08:00
|
|
|
|
e.reply(`请求过快,请${time}秒后重试...`);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let isGet = /导出|获取/.test(e.msg)
|
|
|
|
|
if (!e.isPrivate && isGet) {
|
2022-10-04 21:41:07 +08:00
|
|
|
|
e.reply("请私聊发送")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let authkey = await getAuthKey(e, user)
|
|
|
|
|
if (!authkey) {
|
2022-08-31 23:43:11 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-10-12 16:51:51 +08:00
|
|
|
|
let url = `https://hk4e-api.mihoyo.com/event/gacha_info/api/getGachaLog?authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&gacha_id=fecafa7b6560db5f3182222395d88aaa6aaac1bc×tamp=${Math.floor(Date.now() / 1000)}&lang=zh-cn&device_type=mobile&plat_type=ios®ion=${e.region}&authkey=${encodeURIComponent(authkey)}&game_biz=hk4e_cn&gacha_type=301&page=1&size=5&end_id=0`
|
|
|
|
|
e.msg = url
|
2022-09-26 23:17:54 +08:00
|
|
|
|
// e.reply(e.msg)
|
2022-09-05 11:49:06 +08:00
|
|
|
|
let sendMsg = [];
|
2022-09-03 09:57:59 +08:00
|
|
|
|
e.reply("抽卡记录获取中请稍等...")
|
2022-09-05 11:49:06 +08:00
|
|
|
|
e._reply = e.reply;
|
2022-09-03 09:57:59 +08:00
|
|
|
|
e.reply = (msg) => {
|
|
|
|
|
sendMsg.push(msg)
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
if (isGet) {
|
|
|
|
|
sendMsg = [...sendMsg, ...[1, `uid:${e.uid}`, e.msg]]
|
|
|
|
|
} else {
|
2022-10-04 21:41:07 +08:00
|
|
|
|
if (isV3) {
|
2023-04-14 21:28:35 +08:00
|
|
|
|
let gclog = (await import(`file://${_path}/plugins/genshin/model/gachaLog.js`)).default
|
2022-10-04 21:41:07 +08:00
|
|
|
|
await (new gclog(e)).logUrl()
|
|
|
|
|
} else {
|
|
|
|
|
let {
|
|
|
|
|
bing
|
2023-04-14 21:28:35 +08:00
|
|
|
|
} = (await import(`file://${_path}/lib/app/gachaLog.js`))
|
2022-10-04 21:41:07 +08:00
|
|
|
|
e.isPrivate = true;
|
|
|
|
|
await bing(e)
|
|
|
|
|
}
|
2022-08-31 23:26:24 +08:00
|
|
|
|
}
|
2022-09-05 11:49:06 +08:00
|
|
|
|
await utils.replyMake(e, sendMsg, 1)
|
|
|
|
|
let time = (configData.gclogEx || 5) * 60
|
|
|
|
|
redis.set(`xiaoyao:gclog:${e.user_id}`, Math.floor(Date.now() / 1000) + time, { //数据写入缓存避免重复请求
|
|
|
|
|
EX: time
|
2022-09-01 09:55:26 +08:00
|
|
|
|
});
|
2022-08-31 23:26:24 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2023-07-11 11:53:48 +08:00
|
|
|
|
async function getAuthKey(e, user,data={
|
|
|
|
|
auth_appid:'webview_gacha'
|
|
|
|
|
}) {
|
2022-12-10 15:29:21 +08:00
|
|
|
|
if (!e.uid) {
|
|
|
|
|
e.uid = e?.runtime?.user?._regUid
|
2022-12-08 15:44:13 +08:00
|
|
|
|
}
|
2022-11-19 15:11:56 +08:00
|
|
|
|
e.region = getServer(e.uid)
|
2023-07-11 11:53:48 +08:00
|
|
|
|
let authkeyrow = await user.getData("authKey", data);
|
2022-11-19 15:11:56 +08:00
|
|
|
|
if (!authkeyrow?.data) {
|
2022-12-08 15:44:13 +08:00
|
|
|
|
e.reply(`uid:${e.uid},authkey获取失败:` + (authkeyrow.message.includes("登录失效") ? "请重新绑定stoken" : authkeyrow.message))
|
2022-11-19 15:11:56 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return authkeyrow.data["authkey"];
|
|
|
|
|
}
|
2022-09-05 11:49:06 +08:00
|
|
|
|
export async function mytoken(e) {
|
|
|
|
|
if (!e.isPrivate) {
|
|
|
|
|
e.reply("请私聊发送")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
let user = new User(e);
|
|
|
|
|
let msg = e.msg.replace(/#|我的/g, "");
|
|
|
|
|
let ck, sendMsg;
|
|
|
|
|
if (msg === "stoken") {
|
|
|
|
|
await user.getCookie(e)
|
|
|
|
|
ck = await user.getStoken(e.user_id)
|
|
|
|
|
sendMsg = `stuid=${ck.stuid};stoken=${ck.stoken};ltoken=${ck.ltoken};`;
|
2022-12-10 18:05:04 +08:00
|
|
|
|
if (ck?.mid) sendMsg += `mid=${ck?.mid};`
|
2022-09-05 11:49:06 +08:00
|
|
|
|
} else {
|
|
|
|
|
ck = await user.getyunToken(e);
|
|
|
|
|
sendMsg = `${ck.yuntoken}devId=${ck.devId}`
|
|
|
|
|
}
|
|
|
|
|
if (sendMsg.includes("undefined")) {
|
|
|
|
|
e.reply(`您暂未绑定${msg}`);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
e.reply(sendMsg)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-10-31 21:15:24 +08:00
|
|
|
|
|
2022-12-03 23:52:06 +08:00
|
|
|
|
export async function bindLogin_ticket(e) {
|
|
|
|
|
if (!e.isPrivate) {
|
|
|
|
|
e.reply("请私聊发送")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-10-31 21:15:24 +08:00
|
|
|
|
let user = new User(e);
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let ckMap = await utils.getCookieMap(e.original_msg.replace(/'|"/g, ""))
|
|
|
|
|
let stuid = ckMap?.get("login_uid") ? ckMap?.get("login_uid") : ckMap?.get("ltuid")
|
|
|
|
|
if (!stuid) stuid = ckMap?.get("account_id");
|
|
|
|
|
if (ckMap && Cfg.get("ck.sk")) {
|
|
|
|
|
let res = await user.getData("bbsStoken", {
|
|
|
|
|
loginUid: stuid,
|
|
|
|
|
loginTicket: ckMap.get("login_ticket"),
|
2022-10-31 22:23:11 +08:00
|
|
|
|
})
|
2022-12-03 23:52:06 +08:00
|
|
|
|
if (res?.retcode === 0) {
|
|
|
|
|
e.stuid = stuid;
|
2022-11-10 23:38:34 +08:00
|
|
|
|
await user.seachUid(res)
|
2022-10-31 21:15:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-15 07:11:04 +08:00
|
|
|
|
export async function bindStoken(e, uid = '') {
|
2022-09-05 12:00:53 +08:00
|
|
|
|
if (!e.isPrivate) {
|
|
|
|
|
e.reply("请私聊发送")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-09-05 11:49:06 +08:00
|
|
|
|
let msg = e.msg;
|
|
|
|
|
let user = new User(e);
|
2022-10-04 21:41:07 +08:00
|
|
|
|
await user.cookie(e)
|
2023-04-15 07:11:04 +08:00
|
|
|
|
e.uid = uid || e.uid
|
2022-10-04 21:41:07 +08:00
|
|
|
|
e.region = getServer(e.uid)
|
2022-12-03 23:52:06 +08:00
|
|
|
|
e.cks = msg.replace(/;/g, '&').replace(/stuid/, "uid")
|
2023-02-18 00:11:15 +08:00
|
|
|
|
e.sk = await utils.getCookieMap(msg)
|
2023-04-15 07:11:04 +08:00
|
|
|
|
let res = await user.getData("bbsGetCookie", { cookies: e.cks }, false)
|
2022-10-12 16:51:51 +08:00
|
|
|
|
if (!res?.data) {
|
2023-04-15 07:11:04 +08:00
|
|
|
|
e.uid = "64"
|
2023-02-18 00:11:15 +08:00
|
|
|
|
e.region = getServer(e.uid)
|
2023-04-15 07:11:04 +08:00
|
|
|
|
res = await user.getData("bbsGetCookie", { cookies: e.cks, method: 'post' }, false)
|
|
|
|
|
if (!res?.data) {
|
2023-02-18 00:11:15 +08:00
|
|
|
|
await e.reply(`绑定Stoken失败,异常:${res?.message}\n请发送【stoken帮助】查看配置教程重新配置~`);
|
|
|
|
|
return true;
|
2023-04-15 07:11:04 +08:00
|
|
|
|
} else {
|
2023-02-18 00:11:15 +08:00
|
|
|
|
await user.seachUid(res);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-09-05 11:49:06 +08:00
|
|
|
|
}
|
2023-04-15 07:11:04 +08:00
|
|
|
|
// await user.getCookie(e)
|
2022-11-10 23:38:34 +08:00
|
|
|
|
await user.seachUid(res);
|
2022-09-05 11:49:06 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-10-12 16:51:51 +08:00
|
|
|
|
export async function cloudToken(e) {
|
|
|
|
|
if (e.msg.includes("ltoken") || e.msg.includes("_MHYUUID")) { //防止拦截米社cookie
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (["ct", "si", "devId"].includes(e.msg)) {
|
|
|
|
|
e.reply(`格式支持\nai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-04-15 07:11:04 +08:00
|
|
|
|
let msg = e.msg.replace(/dev(i|l|I|L)d/g, 'devId').split("devId")
|
2022-10-12 16:51:51 +08:00
|
|
|
|
if (msg.length < 2) {
|
2023-01-14 00:29:14 +08:00
|
|
|
|
Bot.logger.mark(`云原神绑定失败:未包含devId字段~`)
|
2022-10-12 16:51:51 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
let devId = msg[1].replace(/=/, "")
|
|
|
|
|
let user = new User(e);
|
|
|
|
|
let yuntoken = msg[0];
|
|
|
|
|
e.devId = devId;
|
|
|
|
|
e.yuntoken = yuntoken;
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let res = await user.cloudSeach()
|
2022-10-12 16:51:51 +08:00
|
|
|
|
if (res.retcode != 0) {
|
2022-10-17 20:55:39 +08:00
|
|
|
|
e.reply(res.message)
|
2022-10-12 16:51:51 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
let datalist = {
|
|
|
|
|
devId: devId,
|
|
|
|
|
yuntoken: yuntoken,
|
|
|
|
|
qq: e.user_id,
|
|
|
|
|
uid: e.uid,
|
|
|
|
|
sign: true
|
|
|
|
|
}
|
|
|
|
|
let yamlStr = YAML.stringify(datalist);
|
|
|
|
|
fs.writeFileSync(`${yunpath}${e.user_id}.yaml`, yamlStr, 'utf8');
|
|
|
|
|
e.reply("云原神cookie保存成功~\n您后续可发送【#云原神查询】获取使用时间~")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-09-05 11:49:06 +08:00
|
|
|
|
|
2022-09-07 00:13:14 +08:00
|
|
|
|
export async function delSign(e) {
|
2022-09-05 11:49:06 +08:00
|
|
|
|
let user = new User(e);
|
2022-09-07 00:13:14 +08:00
|
|
|
|
e.msg = e.msg.replace(/#|删除|我的/g, "");
|
2023-07-11 11:53:48 +08:00
|
|
|
|
let url = /sk|stoken/.test(e.msg) ? `${YamlDataUrl}` : `${yunpath}`;
|
2022-09-07 00:13:14 +08:00
|
|
|
|
await user.delSytk(url, e)
|
2022-09-05 11:49:06 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-09-07 00:13:14 +08:00
|
|
|
|
export async function updCookie(e) {
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let stoken = await gsCfg.getUserStoken(e.user_id);
|
|
|
|
|
if (Object.keys(stoken).length == 0) {
|
2022-09-11 14:41:03 +08:00
|
|
|
|
e.reply("请先绑定stoken\n发送【stoken帮助】查看配置教程")
|
2022-09-06 23:09:04 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
let isGet = e.msg.includes("获取")
|
|
|
|
|
if (!e.isPrivate && isGet) {
|
2022-10-04 21:41:07 +08:00
|
|
|
|
e.reply("请私聊发送")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-10-12 16:51:51 +08:00
|
|
|
|
let user = new User(e);
|
2022-09-06 23:09:04 +08:00
|
|
|
|
let sendMsg = [];
|
|
|
|
|
e._reply = e.reply;
|
|
|
|
|
e.reply = (msg) => {
|
|
|
|
|
sendMsg.push(msg)
|
|
|
|
|
}
|
2022-12-03 23:52:06 +08:00
|
|
|
|
for (let item of Object.keys(stoken)) {
|
2022-09-26 23:17:54 +08:00
|
|
|
|
e.region = getServer(stoken[item].uid)
|
2022-12-03 23:52:06 +08:00
|
|
|
|
e.uid = stoken[item].uid
|
2023-04-15 07:11:04 +08:00
|
|
|
|
if (!e?.uid) {
|
2023-02-26 22:25:56 +08:00
|
|
|
|
Bot.logger.mark(`[刷新ck][stoken读取]qq:${e?.user_id};uid:${e?.uid}`)
|
|
|
|
|
continue; //奇怪的东西
|
2023-04-15 07:11:04 +08:00
|
|
|
|
}
|
2022-12-10 15:29:21 +08:00
|
|
|
|
let cookies = `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}`
|
|
|
|
|
if (stoken[item]?.mid) cookies += `&mid=${stoken[item]?.mid}`
|
2023-02-18 00:11:15 +08:00
|
|
|
|
let data = { cookies: cookies }
|
2023-04-15 07:11:04 +08:00
|
|
|
|
if (e?.uid[0] > 5) data.method = 'post'
|
|
|
|
|
let res = await user.getData("bbsGetCookie", data, false)
|
2022-10-12 16:51:51 +08:00
|
|
|
|
if (!res?.data) {
|
|
|
|
|
e.reply(`uid:${stoken[item].uid},请求异常:${res.message}`)
|
2022-10-04 21:41:07 +08:00
|
|
|
|
continue;
|
2022-09-09 09:14:16 +08:00
|
|
|
|
}
|
2022-10-12 16:51:51 +08:00
|
|
|
|
let ck = res["data"]["cookie_token"];
|
|
|
|
|
e.msg = `ltoken=${stoken[item].ltoken};ltuid=${stoken[item].stuid};cookie_token=${ck}; account_id=${stoken[item].stuid};`
|
2022-12-03 23:52:06 +08:00
|
|
|
|
if (isGet) {
|
|
|
|
|
sendMsg = [...sendMsg, ...[`uid:${stoken[item].uid}`, e.msg]]
|
|
|
|
|
} else {
|
2022-10-04 21:41:07 +08:00
|
|
|
|
if (isV3) {
|
2023-04-14 21:28:35 +08:00
|
|
|
|
let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default
|
2022-10-04 21:41:07 +08:00
|
|
|
|
e.ck = e.msg;
|
|
|
|
|
await (new userck(e)).bing()
|
|
|
|
|
} else {
|
|
|
|
|
let {
|
|
|
|
|
bingCookie
|
2023-04-14 21:28:35 +08:00
|
|
|
|
} = (await import(`file://${_path}/lib/app/dailyNote.js`))
|
2022-10-04 21:41:07 +08:00
|
|
|
|
e.isPrivate = true;
|
|
|
|
|
await bingCookie(e)
|
|
|
|
|
}
|
2022-09-09 09:14:16 +08:00
|
|
|
|
}
|
2022-09-06 23:09:04 +08:00
|
|
|
|
}
|
|
|
|
|
await utils.replyMake(e, sendMsg, 0)
|
|
|
|
|
return true;
|
2022-09-07 00:13:14 +08:00
|
|
|
|
}
|
2022-09-26 23:17:54 +08:00
|
|
|
|
|
2022-12-03 23:52:06 +08:00
|
|
|
|
function getServer(uid) {
|
|
|
|
|
switch (String(uid)[0]) {
|
|
|
|
|
case '1':
|
|
|
|
|
case '2':
|
|
|
|
|
return 'cn_gf01' // 官服
|
|
|
|
|
case '5':
|
|
|
|
|
return 'cn_qd01' // B服
|
|
|
|
|
case '6':
|
|
|
|
|
return 'os_usa' // 美服
|
|
|
|
|
case '7':
|
|
|
|
|
return 'os_euro' // 欧服
|
|
|
|
|
case '8':
|
|
|
|
|
return 'os_asia' // 亚服
|
|
|
|
|
case '9':
|
|
|
|
|
return 'os_cht' // 港澳台服
|
|
|
|
|
}
|
|
|
|
|
return 'cn_gf01'
|
2022-09-26 23:17:54 +08:00
|
|
|
|
}
|