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
6f32c8c081
commit
dcf1548e47
@ -18,7 +18,7 @@ export const rule = {
|
|||||||
},
|
},
|
||||||
updateMiaoPlugin: {
|
updateMiaoPlugin: {
|
||||||
hashMark: true,
|
hashMark: true,
|
||||||
reg: "^#图鉴(强制)?更新",
|
reg: "^#逍遥插件(强制)?更新",
|
||||||
describe: "【#管理】图鉴更新",
|
describe: "【#管理】图鉴更新",
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ export const rule = {
|
|||||||
|
|
||||||
|
|
||||||
const _path = process.cwd();
|
const _path = process.cwd();
|
||||||
const resPath = `${_path}/plugins/cvs-plugin/resources/`;
|
const resPath = `${_path}/plugins/xiaoyao-cvs-plugin/resources/`;
|
||||||
const plusPath = `${resPath}/xiaoyao-plus/`;
|
const plusPath = `${resPath}/xiaoyao-plus/`;
|
||||||
|
|
||||||
const checkAuth = async function (e) {
|
const checkAuth = async function (e) {
|
||||||
@ -71,13 +71,13 @@ export async function updateRes(e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
command = `git clone https://gitee.com/xiao-_-yao/image.git "${resPath}/xiaoyao-plus/"`;
|
command = `git clone https://github.com/ctrlcvs/xiaoyao_plus.git "${resPath}/xiaoyao-plus/"`;
|
||||||
e.reply("开始尝试安装图片加量包,可能会需要一段时间,请耐心等待~");
|
e.reply("开始尝试安装图片加量包,可能会需要一段时间,请耐心等待~\n此链接为github图床,如异常请请求多次");
|
||||||
exec(command, function (error, stdout, stderr) {
|
exec(command, function (error, stdout, stderr) {
|
||||||
if (error) {
|
if (error) {
|
||||||
e.reply("角色图片加量包安装失败!\nError code: " + error.code + "\n" + error.stack + "\n 请稍后重试。");
|
e.reply("角色图片加量包安装失败!\nError code: " + error.code + "\n" + error.stack + "\n 请稍后重试。");
|
||||||
} else {
|
} else {
|
||||||
e.reply("角色图片加量包安装成功!您后续也可以通过 #喵喵更新图像 命令来更新图像");
|
e.reply("角色图片加量包安装成功!您后续也可以通过 #图鉴更新 命令来更新图像");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ export async function updateMiaoPlugin(e) {
|
|||||||
} else {
|
} else {
|
||||||
e.reply("正在执行更新操作,请稍等");
|
e.reply("正在执行更新操作,请稍等");
|
||||||
}
|
}
|
||||||
exec(command, { cwd: `${_path}/plugins/cvs-plugin/` }, function (error, stdout, stderr) {
|
exec(command, { cwd: `${_path}/plugins/xiaoyao-cvs-plugin/` }, function (error, stdout, stderr) {
|
||||||
//console.log(stdout);
|
//console.log(stdout);
|
||||||
if (/Already up to date/.test(stdout)) {
|
if (/Already up to date/.test(stdout)) {
|
||||||
e.reply("目前已经是最新版喵喵了~");
|
e.reply("目前已经是最新版喵喵了~");
|
||||||
@ -110,7 +110,7 @@ export async function updateMiaoPlugin(e) {
|
|||||||
}
|
}
|
||||||
e.reply("喵喵更新成功,尝试重新启动Yunzai以应用更新...");
|
e.reply("喵喵更新成功,尝试重新启动Yunzai以应用更新...");
|
||||||
timer && clearTimeout(timer);
|
timer && clearTimeout(timer);
|
||||||
redis.set("miao:restart-msg", JSON.stringify({
|
redis.set("xiaoyao:restart-msg", JSON.stringify({
|
||||||
msg: "重启成功,新版喵喵已经生效",
|
msg: "重启成功,新版喵喵已经生效",
|
||||||
qq: e.user_id
|
qq: e.user_id
|
||||||
}), { EX: 30 });
|
}), { EX: 30 });
|
||||||
|
@ -10,7 +10,6 @@ const __dirname = path.resolve();
|
|||||||
export async function roleInfo(e) {
|
export async function roleInfo(e) {
|
||||||
// let msg=e.msg.replace(/#|图鉴/g,"");
|
// let msg=e.msg.replace(/#|图鉴/g,"");
|
||||||
let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破/g, "");
|
let msg = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破/g, "");
|
||||||
|
|
||||||
let id = YunzaiApps.mysInfo.roleIdToName(msg);
|
let id = YunzaiApps.mysInfo.roleIdToName(msg);
|
||||||
let name;
|
let name;
|
||||||
if (["10000005", "10000007", "20000000"].includes(id)) {
|
if (["10000005", "10000007", "20000000"].includes(id)) {
|
||||||
@ -23,18 +22,40 @@ export async function roleInfo(e) {
|
|||||||
name = YunzaiApps.mysInfo.roleIdToName(id, true);
|
name = YunzaiApps.mysInfo.roleIdToName(id, true);
|
||||||
if (!name) return false;
|
if (!name) return false;
|
||||||
}
|
}
|
||||||
// console.log(name)
|
|
||||||
|
|
||||||
send_Msg(e, "juese_tujian", name)
|
send_Msg(e, "juese_tujian", name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const send_Msg = function(e, type, name) {
|
const send_Msg = function(e, type, name) {
|
||||||
let path = `${_path}/plugins/cvs-plugin/resources/res-plus/${type}/${name}.png`
|
let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png`
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
|
// 异步读取上级目录下的所有文件
|
||||||
|
fs.readdir(`${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}`, function(err, files) {
|
||||||
|
if (err) {
|
||||||
|
e.reply("出问题了呢建议检查/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/" + type + "有没有")
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
let new_files = [];
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
for (var j = 0; j < name.length; j++) {
|
||||||
|
if (files[i].indexOf(name[j]) >= 0) {
|
||||||
|
new_files.push(files[i])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (new_files.length == 0) {
|
||||||
|
e.reply("刻晴没有找到你想要的" + name+ "哦")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
e.reply("没有找到指定文件呢,您要找的是否是这些:\n"+new_files.join(",").replace(/,/g, ',\n').replace(/(.amr|.mp3|.mp4|.jpg|.png)/g,""))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
e.reply(segment.image(`file:///${path}`));
|
e.reply(segment.image(`file:///${path}`));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
let weapon = new Map();
|
let weapon = new Map();
|
||||||
let weaponFile = [];
|
let weaponFile = [];
|
||||||
@ -46,7 +67,6 @@ export async function init(isUpdate = false) {
|
|||||||
weapon.set(val, i);
|
weapon.set(val, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
weaponFile = fs.readdirSync("./resources/weaponInfo_xiaoyao");
|
weaponFile = fs.readdirSync("./resources/weaponInfo_xiaoyao");
|
||||||
for (let val of weaponFile) {
|
for (let val of weaponFile) {
|
||||||
let name = val.replace(".png", "");
|
let name = val.replace(".png", "");
|
||||||
@ -72,7 +92,7 @@ export async function weaponInfo(e) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function monsterInfo(e) {
|
export async function foodInfo(e) {
|
||||||
|
|
||||||
let msg = e.msg || '';
|
let msg = e.msg || '';
|
||||||
|
|
||||||
@ -80,7 +100,7 @@ export async function monsterInfo(e) {
|
|||||||
msg = "#" + msg.replace("#", "");
|
msg = "#" + msg.replace("#", "");
|
||||||
}
|
}
|
||||||
if (!/(#*食物(.*)|#(.*))$/.test(msg)) return;
|
if (!/(#*食物(.*)|#(.*))$/.test(msg)) return;
|
||||||
let name = msg.replace(/#|#|信息|图鉴|突破|食物/g, "");
|
let name = msg.replace(/#|#|信息|图鉴|食物/g, "");
|
||||||
if (name) {
|
if (name) {
|
||||||
send_Msg(e, "shiwu_tujian", name)
|
send_Msg(e, "shiwu_tujian", name)
|
||||||
return true;
|
return true;
|
||||||
@ -94,10 +114,26 @@ export async function RelicsInfo(e) {
|
|||||||
msg = "#" + msg.replace("#", "");
|
msg = "#" + msg.replace("#", "");
|
||||||
}
|
}
|
||||||
if (!/(#*圣遗物(.*)|#(.*))$/.test(msg)) return;
|
if (!/(#*圣遗物(.*)|#(.*))$/.test(msg)) return;
|
||||||
let name = msg.replace(/#|#|信息|副本|本/g, "");
|
let name = msg.replace(/#|#|信息|副本|本|圣遗物/g, "");
|
||||||
if (name) {
|
if (name) {
|
||||||
send_Msg(e, "shengyiwu_tujian", name)
|
send_Msg(e, "shengyiwu_tujian", name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function monsterInfo(e) {
|
||||||
|
let msg = e.msg || '';
|
||||||
|
if (e.atBot) {
|
||||||
|
msg = "#" + msg.replace("#", "");
|
||||||
|
}
|
||||||
|
if (!/(#*(原魔|怪物)(.*)|#(.*))$/.test(msg)) return;
|
||||||
|
let name = msg.replace(/#|#|信息|副本|本|图鉴|数据|原魔/g, "");
|
||||||
|
console.log(name)
|
||||||
|
if (name) {
|
||||||
|
send_Msg(e, "yuanmo_tujian", name)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
14
index.js
14
index.js
@ -1,6 +1,6 @@
|
|||||||
import lodash from "lodash";
|
import lodash from "lodash";
|
||||||
import {
|
import {
|
||||||
roleInfo,weaponInfo,monsterInfo,RelicsInfo
|
roleInfo,weaponInfo,monsterInfo,RelicsInfo,foodInfo
|
||||||
} from "./apps/xiaoyao_image.js"
|
} from "./apps/xiaoyao_image.js"
|
||||||
import {
|
import {
|
||||||
rule as adminRule,
|
rule as adminRule,
|
||||||
@ -9,7 +9,7 @@ import {
|
|||||||
} from "./apps/admin.js";
|
} from "./apps/admin.js";
|
||||||
export {
|
export {
|
||||||
updateRes,
|
updateRes,
|
||||||
roleInfo,weaponInfo,monsterInfo
|
roleInfo,weaponInfo,monsterInfo,foodInfo,RelicsInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -24,15 +24,13 @@ let rule = {
|
|||||||
},
|
},
|
||||||
roleInfo: {
|
roleInfo: {
|
||||||
reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|素材)$", //匹配消息正则,命令正则
|
reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|素材)$", //匹配消息正则,命令正则
|
||||||
priority: 200, //优先级,越小优先度越高
|
|
||||||
describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", //【命令】功能说明
|
describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", //【命令】功能说明
|
||||||
},
|
},
|
||||||
weaponInfo: {
|
weaponInfo: {
|
||||||
reg: "", //匹配消息正则,命令正则
|
reg: "", //匹配消息正则,命令正则
|
||||||
priority: 200, //优先级,越小优先度越高
|
describe: "武器图鉴【匹配规则】", //【命令】功能说明
|
||||||
describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", //【命令】功能说明
|
|
||||||
},
|
},
|
||||||
monsterInfo:{
|
foodInfo:{
|
||||||
reg: "#*食物(.*)$", //匹配消息正则,命令正则
|
reg: "#*食物(.*)$", //匹配消息正则,命令正则
|
||||||
describe: "食物图鉴", //【命令】功能说明
|
describe: "食物图鉴", //【命令】功能说明
|
||||||
},
|
},
|
||||||
@ -40,6 +38,10 @@ let rule = {
|
|||||||
reg: "#*圣遗物(.*)$", //匹配消息正则,命令正则
|
reg: "#*圣遗物(.*)$", //匹配消息正则,命令正则
|
||||||
describe: "圣遗物图鉴", //【命令】功能说明
|
describe: "圣遗物图鉴", //【命令】功能说明
|
||||||
},
|
},
|
||||||
|
monsterInfo:{
|
||||||
|
reg: "#*原魔(.*)$", //匹配消息正则,命令正则
|
||||||
|
describe: "原魔图鉴", //【命令】功能说明
|
||||||
|
},
|
||||||
...adminRule
|
...adminRule
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 5431648830f17b0d67514b8c41a37eae73b2b497
|
|
Loading…
Reference in New Issue
Block a user