mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
在哪里增加关键字识别,如:#层岩普通宝箱在哪里 (#45)
This commit is contained in:
parent
57f4ae0835
commit
fdddbe9c39
18
apps/map.js
18
apps/map.js
@ -9,7 +9,11 @@ import {
|
|||||||
segment
|
segment
|
||||||
} from "oicq";
|
} from "oicq";
|
||||||
let path = './data/map'
|
let path = './data/map'
|
||||||
|
//mapId-地图别名
|
||||||
|
let getPath={
|
||||||
|
"&map_id=7":["渊下宫",'渊下'],
|
||||||
|
"&map_id=9":['璃月地下','层岩地下','层岩']
|
||||||
|
}
|
||||||
export async function genShenMap(e){
|
export async function genShenMap(e){
|
||||||
let msg= e.msg.replace(/#|(哪|那)|里|在/g,"")
|
let msg= e.msg.replace(/#|(哪|那)|里|在/g,"")
|
||||||
var urlFile = fs.readdirSync(`./data/map/`);
|
var urlFile = fs.readdirSync(`./data/map/`);
|
||||||
@ -18,7 +22,8 @@ export async function genShenMap(e){
|
|||||||
await e.reply(segment.image(`file://${msgPath}`))
|
await e.reply(segment.image(`file://${msgPath}`))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let url=`https://map.minigg.cn/map/get_map?resource_name=${msg}&is_cluster=false`
|
let data=await exReg(msg);
|
||||||
|
let url=`https://map.minigg.cn/map/get_map?resource_name=${data.msg}&is_cluster=false${data.item}`
|
||||||
let res=await fetch(url,{method:'get'})
|
let res=await fetch(url,{method:'get'})
|
||||||
try{
|
try{
|
||||||
res=await res.json()
|
res=await res.json()
|
||||||
@ -33,6 +38,15 @@ export async function genShenMap(e){
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
async function exReg(msg){
|
||||||
|
for (const item of Object.keys(getPath)) {
|
||||||
|
let reg =new RegExp(`${getPath[item].join('|')}`,'g')
|
||||||
|
if(reg.test(msg)){
|
||||||
|
return {item,msg:msg.replace(reg,'')}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {item:'',msg}
|
||||||
|
}
|
||||||
init()
|
init()
|
||||||
/** 初始化创建配置文件 */
|
/** 初始化创建配置文件 */
|
||||||
function init () {
|
function init () {
|
||||||
|
@ -58,8 +58,8 @@ export default class mysTopLogin {
|
|||||||
let UserData = await this.user.getData("getTokenByGameToken", raw)
|
let UserData = await this.user.getData("getTokenByGameToken", raw)
|
||||||
let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw)
|
let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw)
|
||||||
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}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user