6 Star 8 Fork 1

等风来/DF-Plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
help.js 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
其实雨很好 提交于 3个月前 . 🔥删除无用文件
import lodash from "lodash"
import { common, Data } from "#components"
import Theme from "../model/help/theme.js"
export class help extends plugin {
constructor() {
super({
name: "DF:帮助",
dsc: "DF插件命令帮助",
event: "message",
priority: 2000,
rule: [
{
reg: "^#?[Dd][Ff](插件)?帮助$",
fnc: "help"
}
]
})
}
async help(e) {
let custom = {}
let help = {}
let { diyCfg, sysCfg } = await Data.importCfg("help")
custom = help
let helpConfig = lodash.defaults(diyCfg.helpCfg || {}, custom.helpCfg, sysCfg.helpCfg)
let helpList = diyCfg.helpList || custom.helpList || sysCfg.helpList
let helpGroup = []
lodash.forEach(helpList, (group) => {
if (group.auth && group.auth === "master" && !e.isMaster) {
return true
}
lodash.forEach(group.list, (help) => {
let icon = help.icon * 1
if (!icon) {
help.css = "display:none"
} else {
let x = (icon - 1) % 10
let y = (icon - x - 1) / 10
help.css = `background-position:-${x * 50}px -${y * 50}px`
}
})
helpGroup.push(group)
})
let themeData = await Theme.getThemeData(diyCfg.helpCfg || {}, sysCfg.helpCfg || {})
return await common.render("help/index", {
helpCfg: helpConfig,
helpGroup,
...themeData
}, { e, scale: 1.6 })
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/DenFengLai/DF-Plugin.git
git@gitee.com:DenFengLai/DF-Plugin.git
DenFengLai
DF-Plugin
DF-Plugin
master

搜索帮助