diff --git a/apps/user.js b/apps/user.js index a5c611b..66da7f3 100644 --- a/apps/user.js +++ b/apps/user.js @@ -122,7 +122,7 @@ export async function gclog(e) { e.isPrivate = true; await bing(e) } - utils.replyMake(e,sendMsg,1) + await utils.replyMake(e,sendMsg,1) let time=(configData.gclogEx||5)*60 redis.set(`xiaoyao:gclog:${e.user_id}`, Math.floor(Date.now()/1000)+time, { //把色图链接写入缓存防止一直色色 EX: time diff --git a/apps/xiaoyao_image.js b/apps/xiaoyao_image.js index 44fb4a1..3adbd8f 100644 --- a/apps/xiaoyao_image.js +++ b/apps/xiaoyao_image.js @@ -74,7 +74,6 @@ const filePath = async function(e) { msg=e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破/g, ""); } let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${val}/${msg}.png` - console.log(path) if (fs.existsSync(path)) { e.reply(segment.image(`file:///${path}`)); return true; diff --git a/components/Cfg.js b/components/Cfg.js index 44557c5..4e839d8 100644 --- a/components/Cfg.js +++ b/components/Cfg.js @@ -35,6 +35,10 @@ let Cfg = { return false; } return true; + }, + /** 合并默认配置和用户配置 */ + merged() { + return lodash.merge({}, cfg) } }; diff --git a/guoba.support.js b/guoba.support.js new file mode 100644 index 0000000..3a197f9 --- /dev/null +++ b/guoba.support.js @@ -0,0 +1,91 @@ +import path from 'path' +import lodash from 'lodash' +import { + Cfg +} from "./components/index.js"; +/** + * 支持锅巴 + * 锅巴插件:https://gitee.com/guoba-yunzai/guoba-plugin.git + * 组件类型,可参考 https://vvbin.cn/doc-next/components/introduction.html + * https://antdv.com/components/overview-cn/ + */ + +export function supportGuoba() { + return { + pluginInfo: { + name: 'xiaoyao-cvs-plugin', + title: 'xiaoyao-cvs-Plugin', + author: '@逍遥 @cvs', + authorLink: 'https://gitee.com/Ctrlcvs', + link: 'https://gitee.com/Ctrlcvs/xiaoyao-cvs-plugin', + isV3: true, + isV2: true, + description: '主要提供原神图鉴系列数据、以及米游币签到等功能', + // 显示图标,此为个性化配置 + // 图标可在 https://icon-sets.iconify.design 这里进行搜索 + icon: 'mdi:stove', + // 图标颜色,例:#FF0000 或 rgb(255, 0, 0) + iconColor: '#6bb9dd', + // 如果想要显示成图片,也可以填写图标路径(绝对路径) + // iconPath: path.join(_paths.pluginRoot, 'resources/images/icon.png'), + }, + // 配置项信息 + configInfo: { + // 配置项 schemas + schemas: [ + { + field: 'sys.Atlas', + label: '图鉴匹配', + bottomHelpMessage: '是否指定图鉴结尾匹配数据', + component: 'Switch', + }, + { + field: 'Atlas.all', + label: '图鉴目录', + bottomHelpMessage: '是否使用插件的图鉴数据', + component: 'Switch', + }, + { + field: 'sys.help', + label: '默认帮助', + bottomHelpMessage: '使用图鉴插件帮助为默认帮助', + component: 'Switch', + }, + { + field: 'sys.Note', + label: '体力', + bottomHelpMessage: '使用图鉴插件体力为默认体力', + component: 'Switch', + }, + { + field: 'mb.len', + label: '体力模板', + bottomHelpMessage: '体力模板类型', + component: 'Select', + componentProps: { + options: [ + {label: '随机', value: '0'}, + {label: '正方形模板', value: '1'}, + {label: '长方形模板', value: '2'}, + ], + placeholder: '请选择体力模板类型', + }, + }, + ], + // 获取配置数据方法(用于前端填充显示数据) + getConfigData() { + return lodash.omit(Cfg.merged(), 'jwt') + }, + // 设置配置的方法(前端点确定后调用的方法) + setConfigData(data, {Result}) { + + for (let [keyPath, value] of Object.entries(data)) { + Cfg.set(keyPath,value) + } + + + return Result.ok({}, '保存成功~') + }, + }, + } +}