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
0284949fbc
commit
6f32c8c081
@ -27,7 +27,7 @@ export const rule = {
|
||||
|
||||
const _path = process.cwd();
|
||||
const resPath = `${_path}/plugins/cvs-plugin/resources/`;
|
||||
const plusPath = `${resPath}/res-plus/`;
|
||||
const plusPath = `${resPath}/xiaoyao-plus/`;
|
||||
|
||||
const checkAuth = async function (e) {
|
||||
return await e.checkAuth({
|
||||
@ -53,7 +53,7 @@ export async function updateRes(e) {
|
||||
if (fs.existsSync(`${resPath}/res-plus/`)) {
|
||||
e.reply("开始尝试更新,请耐心等待~");
|
||||
command = `git pull`;
|
||||
exec(command, { cwd: `${resPath}/res-plus/` }, function (error, stdout, stderr) {
|
||||
exec(command, { cwd: `${resPath}/xiaoyao-plus/` }, function (error, stdout, stderr) {
|
||||
//console.log(stdout);
|
||||
if (/Already up to date/.test(stdout)) {
|
||||
e.reply("目前所有图片都已经是最新了~");
|
||||
@ -71,7 +71,7 @@ export async function updateRes(e) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
command = `git clone https://gitee.com/leiyilu/image.git "${resPath}/res-plus/"`;
|
||||
command = `git clone https://gitee.com/xiao-_-yao/image.git "${resPath}/xiaoyao-plus/"`;
|
||||
e.reply("开始尝试安装图片加量包,可能会需要一段时间,请耐心等待~");
|
||||
exec(command, function (error, stdout, stderr) {
|
||||
if (error) {
|
||||
|
@ -24,12 +24,12 @@ export async function roleInfo(e) {
|
||||
if (!name) return false;
|
||||
}
|
||||
// console.log(name)
|
||||
|
||||
send_Msg(e,"jiaose_tujian",name)
|
||||
|
||||
send_Msg(e, "juese_tujian", name)
|
||||
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`
|
||||
if (!fs.existsSync(path)) {
|
||||
return true;
|
||||
@ -40,75 +40,64 @@ let weapon = new Map();
|
||||
let weaponFile = [];
|
||||
await init();
|
||||
export async function init(isUpdate = false) {
|
||||
let weaponJson = JSON.parse(fs.readFileSync("./config/genshin/weapon.json", "utf8"));
|
||||
for (let i in weaponJson) {
|
||||
for (let val of weaponJson[i]) {
|
||||
weapon.set(val, i);
|
||||
}
|
||||
}
|
||||
let weaponJson = JSON.parse(fs.readFileSync("./config/genshin/weapon.json", "utf8"));
|
||||
for (let i in weaponJson) {
|
||||
for (let val of weaponJson[i]) {
|
||||
weapon.set(val, i);
|
||||
}
|
||||
}
|
||||
|
||||
weaponFile = fs.readdirSync("./resources/weaponInfo_xiaoyao");
|
||||
for (let val of weaponFile) {
|
||||
let name = val.replace(".png", "");
|
||||
weapon.set(name, name);
|
||||
}
|
||||
weaponFile = fs.readdirSync("./resources/weaponInfo_xiaoyao");
|
||||
for (let val of weaponFile) {
|
||||
let name = val.replace(".png", "");
|
||||
weapon.set(name, name);
|
||||
}
|
||||
}
|
||||
|
||||
export async function weaponInfo(e) {
|
||||
|
||||
let msg = e.msg || '';
|
||||
let msg = e.msg || '';
|
||||
if (e.atBot) {
|
||||
msg = "#" + msg.replace("#", "");
|
||||
}
|
||||
if (!/(#*(.*)(信息|图鉴|突破)|#(.*))$/.test(msg)) return;
|
||||
|
||||
if(e.atBot){
|
||||
msg = "#" + msg.replace("#", "");
|
||||
}
|
||||
|
||||
if(!/(#*(.*)(信息|图鉴|突破)|#(.*))$/.test(msg)) return;
|
||||
let name = weapon.get(msg.replace(/#|#|信息|图鉴|突破/g, ""));
|
||||
|
||||
let name = weapon.get(msg.replace(/#|#|信息|图鉴|突破/g, ""));
|
||||
if (name) {
|
||||
send_Msg(e, "wuqi_tujian", name)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (name) {
|
||||
|
||||
Bot.logger.mark(`[${e.group_name}] ${e.msg}:weaponInfo`);
|
||||
|
||||
let path = `${_path}/resources/weaponInfo_xiaoyao/${name}.png`
|
||||
|
||||
if (!fs.existsSync(path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
e.reply(segment.image(`file:///${path}`));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function monsterInfo(e) {
|
||||
|
||||
let msg = e.msg || '';
|
||||
let msg = e.msg || '';
|
||||
|
||||
if(e.atBot){
|
||||
msg = "#" + msg.replace("#", "");
|
||||
}
|
||||
|
||||
if(!/(#*食物(.*)|#(.*))$/.test(msg)) return;
|
||||
|
||||
let name = weapon.get(msg.replace(/#|#|信息|图鉴|突破|食物/g, ""));
|
||||
|
||||
if (name) {
|
||||
|
||||
Bot.logger.mark(`[${e.group_name}] ${e.msg}:weaponInfo`);
|
||||
|
||||
let path = `${_path}/resources/weaponInfo_xiaoyao/${name}.png`
|
||||
|
||||
if (!fs.existsSync(path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
e.reply(segment.image(`file:///${path}`));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (e.atBot) {
|
||||
msg = "#" + msg.replace("#", "");
|
||||
}
|
||||
if (!/(#*食物(.*)|#(.*))$/.test(msg)) return;
|
||||
let name = msg.replace(/#|#|信息|图鉴|突破|食物/g, "");
|
||||
if (name) {
|
||||
send_Msg(e, "shiwu_tujian", name)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function RelicsInfo(e) {
|
||||
let msg = e.msg || '';
|
||||
if (e.atBot) {
|
||||
msg = "#" + msg.replace("#", "");
|
||||
}
|
||||
if (!/(#*圣遗物(.*)|#(.*))$/.test(msg)) return;
|
||||
let name = msg.replace(/#|#|信息|副本|本/g, "");
|
||||
if (name) {
|
||||
send_Msg(e, "shengyiwu_tujian", name)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
16
index.js
16
index.js
@ -1,6 +1,6 @@
|
||||
import lodash from "lodash";
|
||||
import {
|
||||
roleInfo,weaponInfo
|
||||
roleInfo,weaponInfo,monsterInfo,RelicsInfo
|
||||
} from "./apps/xiaoyao_image.js"
|
||||
import {
|
||||
rule as adminRule,
|
||||
@ -9,7 +9,7 @@ import {
|
||||
} from "./apps/admin.js";
|
||||
export {
|
||||
updateRes,
|
||||
roleInfo,weaponInfo
|
||||
roleInfo,weaponInfo,monsterInfo
|
||||
};
|
||||
|
||||
|
||||
@ -24,14 +24,22 @@ let rule = {
|
||||
},
|
||||
roleInfo: {
|
||||
reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|素材)$", //匹配消息正则,命令正则
|
||||
priority: 900, //优先级,越小优先度越高
|
||||
priority: 200, //优先级,越小优先度越高
|
||||
describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", //【命令】功能说明
|
||||
},
|
||||
weaponInfo: {
|
||||
reg: "", //匹配消息正则,命令正则
|
||||
priority: 900, //优先级,越小优先度越高
|
||||
priority: 200, //优先级,越小优先度越高
|
||||
describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", //【命令】功能说明
|
||||
},
|
||||
monsterInfo:{
|
||||
reg: "#*食物(.*)$", //匹配消息正则,命令正则
|
||||
describe: "食物图鉴", //【命令】功能说明
|
||||
},
|
||||
RelicsInfo:{
|
||||
reg: "#*圣遗物(.*)$", //匹配消息正则,命令正则
|
||||
describe: "圣遗物图鉴", //【命令】功能说明
|
||||
},
|
||||
...adminRule
|
||||
};
|
||||
|
||||
|
1
resources/res-plus
Submodule
1
resources/res-plus
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5431648830f17b0d67514b8c41a37eae73b2b497
|
Loading…
Reference in New Issue
Block a user