mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2025-01-22 13:51:10 +08:00
支持手动指令刷新地图资源数据避免下载的本地文件不是最新,例:#更新落落莓在哪里
This commit is contained in:
parent
fdddbe9c39
commit
b4e01e0f35
@ -8,7 +8,8 @@ import {
|
||||
help
|
||||
} from "./help.js";
|
||||
import {
|
||||
genShenMap
|
||||
rule as mapRule,
|
||||
genShenMap,delMapData
|
||||
} from './map.js'
|
||||
import {
|
||||
Note,
|
||||
@ -49,7 +50,7 @@ import {
|
||||
} from './mhyTopUpLogin.js'
|
||||
export {
|
||||
updateRes, updateTemp,
|
||||
delSign, gcPaylog,
|
||||
delSign, gcPaylog,delMapData,
|
||||
cloudSign,qrCodeLogin,
|
||||
seach, bindLogin_ticket,payOrder,
|
||||
bbsSign,UserPassMsg,UserPassLogin,
|
||||
@ -102,10 +103,7 @@ let rule = {
|
||||
reg: "^#(体力模板(设置(.*)|列表(.*))|(我的体力模板列表|体力模板移除(.*)))$",
|
||||
describe: "体力模板设置",
|
||||
},
|
||||
genShenMap: {
|
||||
reg: "^#(.*)(在(哪|那)里*)$",
|
||||
describe: "地图资源查询 #**在哪里",
|
||||
},
|
||||
|
||||
pokeNote: {
|
||||
reg: "#poke#",
|
||||
describe: "体力",
|
||||
@ -117,7 +115,8 @@ let rule = {
|
||||
...userRule,
|
||||
...signRule,
|
||||
...adminRule,
|
||||
...topupLoginRule
|
||||
...topupLoginRule,
|
||||
...mapRule
|
||||
};
|
||||
|
||||
lodash.forEach(rule, (r) => {
|
||||
|
33
apps/map.js
33
apps/map.js
@ -14,11 +14,38 @@ let getPath={
|
||||
"&map_id=7":["渊下宫",'渊下'],
|
||||
"&map_id=9":['璃月地下','层岩地下','层岩']
|
||||
}
|
||||
export const rule = {
|
||||
genShenMap: {
|
||||
reg: "^#(刷新|更新)?(.*)(在(哪|那)里*)$",
|
||||
describe: "地图资源查询 #**在哪里",
|
||||
},
|
||||
delMapData: {
|
||||
reg: "^#(清空|清除)地图(缓存)?数据$",
|
||||
describe: "清空地图下载数据",
|
||||
},
|
||||
}
|
||||
|
||||
export async function delMapData(e){
|
||||
let urlFile = fs.readdirSync(path);
|
||||
let count=0;
|
||||
for (const item of urlFile) {
|
||||
try {
|
||||
await fs.unlinkSync(`${path}/${item}`)
|
||||
count++;
|
||||
} catch (error) {
|
||||
e.reply('清空地图数据异常~')
|
||||
}
|
||||
}
|
||||
e.reply(`共清除${count}个地图数据~\n您后续可通过直接重新获取地图资源数据~`)
|
||||
return true
|
||||
}
|
||||
|
||||
export async function genShenMap(e){
|
||||
let msg= e.msg.replace(/#|(哪|那)|里|在/g,"")
|
||||
var urlFile = fs.readdirSync(`./data/map/`);
|
||||
let isBool=/刷新|更新/.test(e.msg)
|
||||
let msg= e.msg.replace(/#|(哪|那)|里|在|刷新|更新/g,"")
|
||||
let urlFile = fs.readdirSync(path);
|
||||
let msgPath=`${path}/${msg}.jpg`
|
||||
if(urlFile.includes(`${msg}.jpg`)){
|
||||
if(urlFile.includes(`${msg}.jpg`)&&!isBool){
|
||||
await e.reply(segment.image(`file://${msgPath}`))
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user