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

修正签到指令别名问题,补充游戏签到指令,支持当前账号绑定的全部游戏模块签到(需配置文件有的模块~)

This commit is contained in:
Ctrlcvs 2023-05-07 18:36:14 +08:00
parent a389028b57
commit d2e32faa08
4 changed files with 27 additions and 13 deletions

View File

@ -1,8 +1,14 @@
import User from "../model/user.js"
import moment from 'moment';
import lodash from 'lodash'
import {
Data
} from "../components/index.js";
const _path = process.cwd();
let ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
export const rule = {
sign: {
reg: `^#*(原神|崩坏3|崩坏2|未定事件簿|崩坏星穹铁道)签到$`,
reg: `^#*(${lodash.map(ForumData,v=> v.otherName.join('|')).join('|')}|游戏)签到$`,
describe: "米社规则签到"
},
bbsSign: {

View File

@ -3,42 +3,49 @@
"id": "1",
"forumId": "1",
"name": "崩坏3",
"url": "https://bbs.mihoyo.com/bh3/"
"url": "https://bbs.mihoyo.com/bh3/",
"otherName":["bh3","崩崩崩","崩坏2"]
},
{
"id": "2",
"forumId": "26",
"name": "原神",
"url": "https://bbs.mihoyo.com/ys/"
"url": "https://bbs.mihoyo.com/ys/",
"otherName":["原神"]
},
{
"id": "3",
"forumId": "30",
"name": "崩坏2",
"url": "https://bbs.mihoyo.com/bh2/"
"url": "https://bbs.mihoyo.com/bh2/",
"otherName":["bh2","崩崩","崩坏2"]
},
{
"id": "4",
"forumId": "37",
"name": "未定事件簿",
"url": "https://bbs.mihoyo.com/wd/"
"url": "https://bbs.mihoyo.com/wd/",
"otherName":["事件簿","未定事件簿"]
},
{
"id": "5",
"forumId": "34",
"name": "大别野",
"url": "https://bbs.mihoyo.com/dby/"
"url": "https://bbs.mihoyo.com/dby/",
"otherName":["大别野"]
},
{
"id": "6",
"forumId": "52",
"name": "崩坏星穹铁道",
"url": "https://bbs.mihoyo.com/sr/"
"url": "https://bbs.mihoyo.com/sr/",
"otherName":["sr","星铁","穹轨","崩坏星穹铁道"]
},
{
"id": "7",
"forumId": "57",
"name": "绝区零",
"url": "https://bbs.mihoyo.com/zzz/"
"url": "https://bbs.mihoyo.com/zzz/",
"otherName":["绝区零","zzz"]
}
]

View File

@ -118,9 +118,9 @@ export async function getCookieMap(cookie) {
*/
export function recallMsg(e,r,times){
setTimeout(()=>{
if(e?.group){
if(e?.group?.recallMsg){
e?.group?.recallMsg(r.message_id)
}else{
}else if(e?.friend?.recallMsg){
e?.friend?.recallMsg(r.message_id)
}
},1000 * times)

View File

@ -857,9 +857,10 @@ export default class user {
})
}
getDataList(name) {
for (let item of this.ForumData) {
if (item.name == name) { //循环结束未找到的时候返回原数组签到全部
return [item]
let otherName = lodash.map(this.ForumData,'otherName')
for (let [index,item] of Object.entries(otherName)) {
if (item.includes(name)) { //循环结束未找到的时候返回原数组签到全部
return [this.ForumData[index]]
}
}
return this.ForumData;