2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-22 19:10:53 +08:00

修正在个别系统下体力模板列表图片无法显示问题

This commit is contained in:
Ctrlcvs 2022-10-31 21:15:24 +08:00
parent 46a0f290e7
commit 4e4af821a4
7 changed files with 80 additions and 48 deletions

View File

@ -7,6 +7,9 @@
* 新增`#图鉴模板更新`
* 用于更新体力模板具体来源由**@SunRyK** **@地球生物** **@逍遥** 三位作者上传
* 不会冲突已添加的模板数据,有需求可通过指令拉取
* 新增`#图鉴设置获取sk开启、关闭`
* 绑定ck时自动获取sk
* 风险自担!!! 插件只负责提供功能
# 1.2.3
* 新增地图资源查询功能
* `#月莲在哪里` 指令类似 `某某物品在哪里`

View File

@ -430,15 +430,16 @@ export async function Note_appoint(e) {
for (let [index, item] of keyType.entries()) {
let msg_pass = [];
let imgurl;
let pathFile=urlType[item].replace(/\./,_path)
if (item.includes(".")) {
imgurl = await segment.image(`file:///${urlType[item]}`);
imgurl = await segment.image(`file:///${pathFile}`);
item = item.split(".")[0];
} else {
imgurl = await segment.image(
`file:///${urlType[item]}/icon/bg/${fs.readdirSync(`${urlType[item]}/icon/bg/`)[0]}`
`file:///${pathFile}/icon/bg/${fs.readdirSync(`${pathFile}/icon/bg/`)[0]}`
)
}
if (isUser && !temp.includes(item)) {
if (isUser && !temp?.includes(item)) {
continue;
}
item = index + 1 + "." + item
@ -489,7 +490,7 @@ export async function Note_appoint(e) {
if (typeof tempData[e.user_id]["temp"] === "string") {
temp = [tempData[e.user_id]["temp"], msg]
} else {
if (!tempData[e.user_id]["temp"].includes(msg)) {
if (!tempData[e.user_id]["temp"]?.includes(msg)) {
temp = [...tempData[e.user_id]["temp"], msg]
}
}

View File

@ -23,6 +23,7 @@ let cfgMap = {
"匹配": "sys.Atlas",
"戳一戳":"note.poke",
"模板": "mb.len",
"获取sk":"ck.sk",
"目录":"Atlas.all",
};
let sysCfgReg = `^#图鉴设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`;
@ -67,6 +68,7 @@ export async function sysCfg(e, {
if (!regRet) {
return true;
}
if (regRet[1]) {
// 设置模式
@ -85,14 +87,13 @@ export async function sysCfg(e, {
Cfg.set(cfgKey, val);
}
}
// e.reply("设置成功!!");
// return true;
let cfg = {
help: getStatus("sys.help", false),
Note: getStatus("sys.Note",false),
Atlas: getStatus("sys.Atlas",false),
len:Cfg.get("mb.len", 0),
poke: getStatus("note.poke",false),
isSk: getStatus("ck.sk",false),
imgPlus: fs.existsSync(plusPath),
notePlus: fs.existsSync(notePlus),
bg: await rodom(), //获取底图

View File

@ -33,7 +33,7 @@ import {
userInfo,
gclog,
mytoken,
bindStoken,
bindStoken,bindLogin_ticket,
cloudToken
} from "./user.js"
import {
@ -50,7 +50,7 @@ export {
updateRes,updateTemp,
delSign,
cloudSign,
seach,
seach,bindLogin_ticket,
bbsSign,
gclog,
mytoken,

View File

@ -35,6 +35,10 @@ export const rule = {
reg: "^(.*)stoken=(.*)$",
describe: "绑定stoken"
},
bindLogin_ticket: {
reg: "^(.*)login_ticket=(.*)$",
describe: "绑定ck自动获取sk"
},
cloudToken: {
reg: "^(.*)ct(.*)$",
describe: "云原神签到token获取"
@ -156,6 +160,29 @@ export async function mytoken(e) {
e.reply(sendMsg)
return true;
}
export async function bindLogin_ticket(e){
let user = new User(e);
let ckMap=await utils.getCookieMap(e.original_msg.replace(/'|"/g,""))
if(ckMap&&Cfg.get("ck.sk")){
let res= await user.getData("bbsStoken", {
loginUid:ckMap?.get("login_uid") ? ckMap?.get("login_uid") : ckMap?.get("ltuid"),
loginTicket:ckMap.get("login_ticket"),
},false)
if(res?.retcode===0){
let msg = 'stoken绑定成功您可通过下列指令进行操作:';
msg += '\n【#米币查询】查询米游币余额'
msg += '\n【#mys原神签到】获取米游币'
msg += '\n【#更新抽卡记录】更新抽卡记录'
msg += '\n【#刷新ck】刷新失效cookie'
msg += '\n【#我的stoken】查看绑定信息'
msg += '\n【#删除stoken】删除绑定信息'
e.reply(msg)
}
}
return false;
}
export async function bindStoken(e) {
if (!e.isPrivate) {
e.reply("请私聊发送")

View File

@ -34,6 +34,6 @@ gclogEx: 5
# 体力设置开启关闭权限 1-群管理员才能开启关闭 2-主人才能开启关闭
noteSetAuth: 2
# 体力推送 间隔 10分钟检索一次
noteTask: 0 0/10 * * ?
noteTask: 0 0/10 * * * ?
# 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭
isNoteTask: false

View File

@ -111,7 +111,14 @@
</div>
<div class="cfg-desc">可选值50~200建议100。设置高精度会提高图片的精细度但因图片较大可能会影响渲染与发送速度</div>
</li> -->
<li class="cfg-li">
<div class="cfg-line">
拦截绑定ck自动获取stoken
<span class="cfg-hint">#图鉴设置获取sk + 开启/关闭</span>
{{@isSk}}
</div>
<div class="cfg-desc">开启后将拦截login_ticket自动获取stoken</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
图鉴作为默认帮助
@ -136,14 +143,7 @@
</div>
<div class="cfg-desc">需开启图鉴版体力作为Yunzai的默认体力,当前模板支持0(随机)以及1-2</div>
</li>
<!-- <li class="cfg-li">
<div class="cfg-line">
更新版本
<div class="cfg-status">#喵喵更新</div>
</div>
<div class="cfg-desc">更新喵喵Plugin可能需要重启Yunzai-Bot</div>
</li>-->
</ul>
</div>
{{/block}}