mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
658217ee8f
* `#喵喵版本` 使用图片展示更新信息 * 页面版权信息展示Yunzai及喵喵版本号 * `#角色面板` 伤害计算增加 迪奥娜ⁿᵉʷ、安柏ⁿᵉʷ、凯亚ⁿᵉʷ
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import { Cfg } from "../components/index.js";
|
|
import { segment } from "oicq";
|
|
import lodash from "lodash";
|
|
import { currentVersion, changelogs } from "../components/Changelog.js";
|
|
import Common from "../components/Common.js";
|
|
|
|
const _path = process.cwd();
|
|
const helpFilePath = `${_path}/plugins/miao-plugin/resources/help/help-list.js`;
|
|
|
|
export async function help(e, { render }) {
|
|
|
|
if (!/喵喵/.test(e.msg) && !Cfg.get("sys.help", false)) {
|
|
return false;
|
|
}
|
|
|
|
let helpFile = {};
|
|
helpFile = await import(`file://${helpFilePath}?version=${new Date().getTime()}`);
|
|
|
|
const { helpCfg } = helpFile;
|
|
let helpGroup = [];
|
|
|
|
lodash.forEach(helpCfg, (group) => {
|
|
if (group.auth && group.auth === "master" && !e.isMaster) {
|
|
return;
|
|
}
|
|
|
|
|
|
lodash.forEach(group.list, (help) => {
|
|
let icon = help.icon * 1;
|
|
if (!icon) {
|
|
help.css = `display:none`;
|
|
} else {
|
|
let x = (icon - 1) % 10, y = (icon - x - 1) / 10;
|
|
help.css = `background-position:-${x * 50}px -${y * 50}px`;
|
|
}
|
|
|
|
});
|
|
|
|
helpGroup.push(group);
|
|
});
|
|
|
|
return await Common.render("help/index", {
|
|
helpCfg: helpGroup,
|
|
element: 'default'
|
|
}, { e, render, scale: 1.2 })
|
|
}
|
|
|
|
export async function versionInfo(e, { render }) {
|
|
return await Common.render("help/version-info", {
|
|
currentVersion,
|
|
changelogs,
|
|
}, { e, render, scale: 1.2 })
|
|
} |