2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +08:00
This commit is contained in:
Ctrlcvs 2023-04-23 19:34:42 +08:00
commit d8b5da36f3
9 changed files with 70 additions and 37 deletions

View File

@ -255,11 +255,11 @@ export async function Note_appoint(e) {
let imgurl; let imgurl;
let pathFile = urlType[item].replace(/\./, _path) let pathFile = urlType[item].replace(/\./, _path)
if (item.includes(".")) { if (item.includes(".")) {
imgurl = await segment.image(`file:///${pathFile}`); imgurl = await segment.image(`file://${pathFile}`);
item = item.split(".")[0]; item = item.split(".")[0];
} else { } else {
imgurl = await segment.image( imgurl = await segment.image(
`file:///${pathFile}/icon/bg/${fs.readdirSync(`${pathFile}/icon/bg/`)[0]}` `file://${pathFile}/icon/bg/${fs.readdirSync(`${pathFile}/icon/bg/`)[0]}`
) )
} }
if (isUser && !temp?.includes(item)) { if (isUser && !temp?.includes(item)) {

View File

@ -19,6 +19,7 @@ let cfgMap = {
"模板": "mb.len", "模板": "mb.len",
"获取sk":"ck.sk", "获取sk":"ck.sk",
"目录":"Atlas.all", "目录":"Atlas.all",
"扫码绑定":'mhy.qrcode',
}; };
let sysCfgReg = `^#图鉴设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`; let sysCfgReg = `^#图鉴设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`;
export const rule = { export const rule = {
@ -74,6 +75,8 @@ export async function sysCfg(e, {
val = Math.min(200, Math.max(50, val * 1 || 100)); val = Math.min(200, Math.max(50, val * 1 || 100));
}else if(cfgKey === "mb.len"){ }else if(cfgKey === "mb.len"){
val= Math.min(2,Math.max(val,0)); val= Math.min(2,Math.max(val,0));
}else if(cfgKey==='mhy.qrcode'){
val= Math.min(3,Math.max(val,0));
} else { } else {
val = !/关闭/.test(val); val = !/关闭/.test(val);
} }
@ -88,6 +91,7 @@ export async function sysCfg(e, {
len:Cfg.get("mb.len", 0), len:Cfg.get("mb.len", 0),
poke: getStatus("note.poke",false), poke: getStatus("note.poke",false),
isSk: getStatus("ck.sk",false), isSk: getStatus("ck.sk",false),
qrcode:Cfg.get("mhy.qrcode", 0),
imgPlus: fs.existsSync(plusPath), imgPlus: fs.existsSync(plusPath),
notePlus: fs.existsSync(notePlus), notePlus: fs.existsSync(notePlus),
bg: await rodom(), //获取底图 bg: await rodom(), //获取底图

View File

@ -5,6 +5,9 @@ import mys from "../model/mhyTopUpLogin.js"
import Common from "../components/Common.js"; import Common from "../components/Common.js";
import { bindStoken } from './user.js' import { bindStoken } from './user.js'
import utils from '../model/mys/utils.js'; import utils from '../model/mys/utils.js';
import {
Cfg,
} from "../components/index.js";
const _path = process.cwd(); const _path = process.cwd();
export const rule = { export const rule = {
qrCodeLogin: { qrCodeLogin: {
@ -41,6 +44,17 @@ export async function payOrder(e, { render }) {
} }
export async function qrCodeLogin(e, { render }) { export async function qrCodeLogin(e, { render }) {
let power = Cfg.get("mhy.qrcode")
if (power === 3) {
return false;
} else {
if (power == 2 && !e.isPrivate) {
return false;
}
if (power == 1 && !e.isGroup) {
return false;
}
}
let Mys = new mys(e) let Mys = new mys(e)
let res = await Mys.qrCodeLogin() let res = await Mys.qrCodeLogin()
if (!res?.data) return false; if (!res?.data) return false;
@ -89,15 +103,15 @@ export async function UserPassLogin(e) {
export async function bindSkCK(e, res) { export async function bindSkCK(e, res) {
e.msg = res?.stoken, e.raw_message = res?.stoken e.msg = res?.stoken, e.raw_message = res?.stoken
e.isPrivate = true e.isPrivate = true
await bindStoken(e) await bindStoken(e, '1')
e.ck = res?.cookie, e.msg = res.cookie, e.raw_message = res.cookie; e.ck = res?.cookie, e.msg = res.cookie, e.raw_message = res.cookie;
if (isV3) { if (isV3) {
let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default
await (new userck(e)).bing() await (new userck(e)).bing()
} else { } else {
let { let {
bingCookie bingCookie
} = (await import(`file:///${_path}/lib/app/dailyNote.js`)) } = (await import(`file://${_path}/lib/app/dailyNote.js`))
await bingCookie(e) await bingCookie(e)
} }
} }

View File

@ -119,7 +119,7 @@ export async function gcPaylog(e) {
EX: time EX: time
}); });
if (isV3) { if (isV3) {
let { payLog } = (await import(`file:///${_path}/plugins/genshin/apps/payLog.js`)) let { payLog } = (await import(`file://${_path}/plugins/genshin/apps/payLog.js`))
let pl = (new payLog()) let pl = (new payLog())
e.isGroup = false; e.isGroup = false;
pl.e = e pl.e = e
@ -166,12 +166,12 @@ export async function gclog(e) {
sendMsg = [...sendMsg, ...[1, `uid:${e.uid}`, e.msg]] sendMsg = [...sendMsg, ...[1, `uid:${e.uid}`, e.msg]]
} else { } else {
if (isV3) { if (isV3) {
let gclog = (await import(`file:///${_path}/plugins/genshin/model/gachaLog.js`)).default let gclog = (await import(`file://${_path}/plugins/genshin/model/gachaLog.js`)).default
await (new gclog(e)).logUrl() await (new gclog(e)).logUrl()
} else { } else {
let { let {
bing bing
} = (await import(`file:///${_path}/lib/app/gachaLog.js`)) } = (await import(`file://${_path}/lib/app/gachaLog.js`))
e.isPrivate = true; e.isPrivate = true;
await bing(e) await bing(e)
} }
@ -242,7 +242,7 @@ export async function bindLogin_ticket(e) {
return false; return false;
} }
export async function bindStoken(e) { export async function bindStoken(e, uid = '') {
if (!e.isPrivate) { if (!e.isPrivate) {
e.reply("请私聊发送") e.reply("请私聊发送")
return true; return true;
@ -250,10 +250,11 @@ export async function bindStoken(e) {
let msg = e.msg; let msg = e.msg;
let user = new User(e); let user = new User(e);
await user.cookie(e) await user.cookie(e)
e.uid = uid || e.uid
e.region = getServer(e.uid) e.region = getServer(e.uid)
e.cks = msg.replace(/;/g, '&').replace(/stuid/, "uid") e.cks = msg.replace(/;/g, '&').replace(/stuid/, "uid")
e.sk = await utils.getCookieMap(msg) e.sk = await utils.getCookieMap(msg)
let res = await user.getData("bbsGetCookie", { cookies: e.cks }) let res = await user.getData("bbsGetCookie", { cookies: e.cks }, false)
if (!res?.data) { if (!res?.data) {
e.uid = "64" e.uid = "64"
e.region = getServer(e.uid) e.region = getServer(e.uid)
@ -266,7 +267,7 @@ export async function bindStoken(e) {
return true; return true;
} }
} }
await user.getCookie(e) // await user.getCookie(e)
await user.seachUid(res); await user.seachUid(res);
return true; return true;
} }
@ -352,13 +353,13 @@ export async function updCookie(e) {
sendMsg = [...sendMsg, ...[`uid:${stoken[item].uid}`, e.msg]] sendMsg = [...sendMsg, ...[`uid:${stoken[item].uid}`, e.msg]]
} else { } else {
if (isV3) { if (isV3) {
let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default
e.ck = e.msg; e.ck = e.msg;
await (new userck(e)).bing() await (new userck(e)).bing()
} else { } else {
let { let {
bingCookie bingCookie
} = (await import(`file:///${_path}/lib/app/dailyNote.js`)) } = (await import(`file://${_path}/lib/app/dailyNote.js`))
e.isPrivate = true; e.isPrivate = true;
await bingCookie(e) await bingCookie(e)
} }

View File

@ -70,7 +70,7 @@ export async function getBasicVoide(e) {
if (source) { if (source) {
let imgPath = await redis.get(`xiaoyao:basic:${source.message_id}`) let imgPath = await redis.get(`xiaoyao:basic:${source.message_id}`)
if (imgPath) { if (imgPath) {
e.reply([segment.video(`file:///${imgPath}`)]) e.reply([segment.video(`file://${imgPath}`)])
return true return true
} }
if (source.time) { if (source.time) {
@ -129,7 +129,7 @@ const filePath = async function (e) {
} }
let path = `${pathPlus}${val}/${msg}.png` let path = `${pathPlus}${val}/${msg}.png`
if (fs.existsSync(path)) { if (fs.existsSync(path)) {
e.reply(segment.image(`file:///${path}`)); e.reply(segment.image(`file://${path}`));
return true; return true;
} }
} }
@ -154,9 +154,9 @@ const send_Msg = async function (e, type, name) {
if (!fs.existsSync(path)) { if (!fs.existsSync(path)) {
return false; return false;
} }
let msg = segment.image(`file:///${path}`) let msg = segment.image(`file://${path}`)
try { try {
if (/动态|幻影/.test(e.msg)) msg = segment.video(`file:///${path.replace(/\.png|\.jpg/, '.mp4')}`) if (/动态|幻影/.test(e.msg)) msg = segment.video(`file://${path.replace(/\.png|\.jpg/, '.mp4')}`)
} catch (error) { } catch (error) {
Bot.logger.error(`发送七圣动态数据失败:` + error) Bot.logger.error(`发送七圣动态数据失败:` + error)
// error // error

View File

@ -26,7 +26,7 @@ export default class mysTopLogin {
this.e.reply(this.sendMsgUser) this.e.reply(this.sendMsgUser)
let res = await this.user.getData("qrCodeLogin", { let res = await this.user.getData("qrCodeLogin", {
device: this.device device: this.device
}) },false)
if (!res.data) { if (!res.data) {
return false; return false;
} }
@ -41,14 +41,14 @@ export default class mysTopLogin {
await utils.sleepAsync(5000) await utils.sleepAsync(5000)
res = await this.user.getData("qrCodeQuery", { res = await this.user.getData("qrCodeQuery", {
device: this.device, ticket device: this.device, ticket
}) },false)
if (res?.data?.stat == "Scanned" && RedisData.GetQrCode == 1) { if (res?.data?.stat == "Scanned" && RedisData.GetQrCode == 1) {
Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) Bot.logger.mark(JSON.stringify(res))
await this.e.reply("二维码已扫描,请确认登录", true) await this.e.reply("二维码已扫描,请确认登录", true)
RedisData.GetQrCode++; RedisData.GetQrCode++;
} }
if (res?.data?.stat == "Confirmed") { if (res?.data?.stat == "Confirmed") {
Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) Bot.logger.mark(JSON.stringify(res))
break break
} }
} }
@ -58,8 +58,8 @@ export default class mysTopLogin {
return false return false
} }
let raw = JSON.parse(res?.data?.payload?.raw) let raw = JSON.parse(res?.data?.payload?.raw)
let UserData = await this.user.getData("getTokenByGameToken", raw) let UserData = await this.user.getData("getTokenByGameToken", raw,false)
let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw) let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw,false)
return { return {
cookie: `ltoken=${UserData.data?.token?.token};ltuid=${UserData.data?.user_info?.aid};cookie_token=${ck.data?.cookie_token}`, cookie: `ltoken=${UserData.data?.token?.token};ltuid=${UserData.data?.user_info?.aid};cookie_token=${ck.data?.cookie_token}`,
stoken: `stoken=${UserData.data?.token?.token};stuid=${UserData.data?.user_info?.aid};mid=${UserData?.data?.user_info.mid}` stoken: `stoken=${UserData.data?.token?.token};stuid=${UserData.data?.user_info?.aid};mid=${UserData?.data?.user_info.mid}`
@ -120,7 +120,7 @@ export default class mysTopLogin {
} }
async crack_geetest() { async crack_geetest() {
let res = ""; //await this.user.getData("microgg", this.aigis_captcha_data, false) let res = ""; //await this.user.getData("microgg", this.aigis_captcha_data, false)
Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) // Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`)
await this.e.reply(`请完成验证https://challenge.minigg.cn/manual/index.html?gt=${this.aigis_captcha_data.gt}&challenge=${this.aigis_captcha_data.challenge}`, true) await this.e.reply(`请完成验证https://challenge.minigg.cn/manual/index.html?gt=${this.aigis_captcha_data.gt}&challenge=${this.aigis_captcha_data.challenge}`, true)
for (let n = 1; n < 60; n++) { for (let n = 1; n < 60; n++) {
await utils.sleepAsync(5000) await utils.sleepAsync(5000)

View File

@ -131,6 +131,7 @@ export default class miHoYoApi {
return res return res
} }
getUrl(type, board, data) { getUrl(type, board, data) {
// if(/qrCodeLogin|qrCodeQuery|getTokenByGameToken|getCookieAccountInfoByGameToken/.test(type)) this.isOs=false;
let urlMap = { let urlMap = {
userGameInfo: { //通用查询 userGameInfo: { //通用查询
url: `${this.apiMap.apiWeb}/binding/api/getUserGameRolesByCookie`, url: `${this.apiMap.apiWeb}/binding/api/getUserGameRolesByCookie`,

View File

@ -70,10 +70,15 @@ export async function replyMake(e, _msg, lenght) {
user_id: Bot.uin user_id: Bot.uin
}) })
} }
if (e._reply) { if (e.isGroup) {
e._reply(await Bot.makeForwardMsg(msgList)); msgList = await e.group.makeForwardMsg(msgList)
} else { } else {
e.reply(await Bot.makeForwardMsg(msgList)); msgList = await e.friend.makeForwardMsg(msgList)
}
if (e._reply) {
e._reply(msgList);
} else {
e.reply(msgList);
} }
} }

View File

@ -119,6 +119,14 @@
</div> </div>
<div class="cfg-desc">开启后将拦截login_ticket自动获取stoken</div> <div class="cfg-desc">开启后将拦截login_ticket自动获取stoken</div>
</li> </li>
<li class="cfg-li">
<div class="cfg-line">
扫码绑定
<span class="cfg-hint">#图鉴设置扫码绑定 + (0~3)</span>
<div class="cfg-status">{{@qrcode}}</div>
</div>
<div class="cfg-desc">0不限制1限制群聊使用2限制私聊使用3禁用功能</div>
</li>
<li class="cfg-li"> <li class="cfg-li">
<div class="cfg-line"> <div class="cfg-line">
图鉴作为默认帮助 图鉴作为默认帮助