2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 03:20:52 +08:00
xiaoyao-cvs-plugin/apps/index.js

154 lines
2.7 KiB
JavaScript
Raw Normal View History

2022-07-24 11:46:05 +08:00
import lodash from "lodash";
2022-08-01 23:13:34 +08:00
import schedule from "node-schedule";
2022-07-24 11:46:05 +08:00
import {
AtlasAlias
} from "./xiaoyao_image.js";
import {
versionInfo,
help
} from "./help.js";
2022-10-31 13:57:07 +08:00
import {
genShenMap
} from './map.js'
2022-07-24 11:46:05 +08:00
import {
2022-08-01 23:13:34 +08:00
Note,
DailyNoteTask,
Note_appoint,
2022-10-31 13:57:07 +08:00
noteTask,
2022-08-01 23:13:34 +08:00
pokeNote
2022-07-24 11:46:05 +08:00
} from "./Note.js";
import {
rule as adminRule,
updateRes,
2022-10-31 13:57:07 +08:00
sysCfg,updateTemp,
2022-07-24 11:46:05 +08:00
updateMiaoPlugin
} from "./admin.js";
import {
currentVersion
} from "../components/Changelog.js";
2022-08-16 23:24:54 +08:00
import {
2022-10-31 13:57:07 +08:00
rule as userRule,
delSign,
updCookie,
userInfo,
gclog,
mytoken,
bindStoken,
cloudToken
2022-08-16 23:24:54 +08:00
} from "./user.js"
2022-07-29 01:42:35 +08:00
import {
rule as signRule,
2022-10-31 13:57:07 +08:00
sign,
bbsSign,
cloudSign,
seach,
cookiesDocHelp,
signTask
2022-07-29 01:42:35 +08:00
} from "./sign.js"
2022-10-12 16:51:51 +08:00
2022-07-24 11:46:05 +08:00
export {
2022-10-31 13:57:07 +08:00
updateRes,updateTemp,
delSign,
cloudSign,
seach,
bbsSign,
gclog,
mytoken,
bindStoken,
updateMiaoPlugin,
userInfo,
2022-10-12 16:51:51 +08:00
sign,
2022-10-31 13:57:07 +08:00
versionInfo,
cloudToken,
Note_appoint,
signTask,
pokeNote,
genShenMap,
2022-10-12 16:51:51 +08:00
cookiesDocHelp,
2022-07-24 11:46:05 +08:00
sysCfg,
2022-10-31 13:57:07 +08:00
help,
updCookie,
2022-08-01 23:13:34 +08:00
DailyNoteTask,
2022-10-31 13:57:07 +08:00
noteTask,
2022-07-24 11:46:05 +08:00
AtlasAlias,
2022-08-01 23:13:34 +08:00
Note,
2022-07-24 11:46:05 +08:00
};
2022-08-01 23:13:34 +08:00
import gsCfg from '../model/gsCfg.js';
2022-10-17 20:55:39 +08:00
import Data from "../components/Data.js";
2022-08-01 23:13:34 +08:00
const _path = process.cwd();
2022-07-24 11:46:05 +08:00
let rule = {
versionInfo: {
reg: "^#图鉴版本$",
describe: "【#帮助】 图鉴版本介绍",
},
help: {
reg: "^#?(图鉴)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$",
describe: "查看插件的功能",
},
AtlasAlias: {
reg: "^(#(.*)|.*图鉴)$",
describe: "角色、食物、怪物、武器信息图鉴",
},
Note: {
reg: "^#*(体力|树脂|查询体力|便笺|便签)$",
describe: "体力",
},
2022-10-31 13:57:07 +08:00
noteTask: {
reg: "^#*((开启|关闭)体力推送|体力设置群(推送(开启|关闭)|(阈值|上限)(\\d*)))$",
describe: "体力推送",
},
2022-07-24 11:46:05 +08:00
Note_appoint: {
2022-10-31 13:57:07 +08:00
reg: "^#体力模板(设置(.*)|列表(.*))|(#我的体力模板列表)$",
2022-07-24 11:46:05 +08:00
describe: "体力模板设置",
},
2022-10-31 13:57:07 +08:00
genShenMap: {
reg: "^#(.*)(在(哪|那)里*)$",
2022-10-19 07:05:20 +08:00
describe: "地图资源查询 #**在哪里",
},
2022-07-24 11:46:05 +08:00
pokeNote: {
reg: "#poke#",
describe: "体力",
},
2022-08-16 23:24:54 +08:00
...userRule,
2022-07-29 01:42:35 +08:00
...signRule,
2022-07-24 11:46:05 +08:00
...adminRule
};
lodash.forEach(rule, (r) => {
r.priority = r.priority || 50;
r.prehash = true;
r.hashMark = true;
});
2022-08-01 23:13:34 +08:00
task();
//定时任务
async function task() {
if (typeof test != "undefined") return;
let set = gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config")
2022-08-03 22:56:01 +08:00
schedule.scheduleJob(set.mysBbsTime, function() {
2022-10-31 13:57:07 +08:00
if (set.ismysSign) {
signTask('bbs')
2022-08-03 22:56:01 +08:00
}
2022-10-31 13:57:07 +08:00
});
2022-08-03 22:56:01 +08:00
schedule.scheduleJob(set.allSignTime, function() {
if (set.isSign) {
2022-10-12 16:51:51 +08:00
signTask('mys')
2022-08-03 22:56:01 +08:00
}
});
2022-10-31 13:57:07 +08:00
schedule.scheduleJob(set.cloudSignTime, function() {
if (set.isCloudSign) {
2022-10-12 16:51:51 +08:00
signTask('cloud')
}
});
2022-10-31 13:57:07 +08:00
schedule.scheduleJob(set.noteTask, function() {
if (set.isNoteTask) {
DailyNoteTask()
}
});
2022-08-01 23:13:34 +08:00
}
2022-07-24 11:46:05 +08:00
export {
rule
2022-08-01 23:13:34 +08:00
};