From 0c47ad329ec5fbe1cf3693800caa517d403df28a Mon Sep 17 00:00:00 2001 From: yeyang <746659424@qq.com> Date: Fri, 7 Oct 2022 11:11:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0#=E6=A4=B0=E5=A5=B6=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 +++++-- apps/admin.js | 41 ++++++++++++++++++++++++++++++-- apps/set.js | 2 +- apps/sing.js | 2 +- components/common-lib/render.js | 2 +- index.js | 2 +- resources/help/version-info.html | 4 ++-- 7 files changed, 51 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca3aa2a..8015e46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,6 @@ -# 1.0.0 -* 椰奶插件v1.0 \ No newline at end of file +# 1.0.1 +* 增加`#椰奶帮助` +* 增加`#椰奶版本` +* 增加`#椰奶更新日志` +# 1.0.0 +* 椰奶插件v1.0 diff --git a/apps/admin.js b/apps/admin.js index bf8b7ae..b5d80f1 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -1,5 +1,8 @@ import plugin from '../../../lib/plugins/plugin.js' import { createRequire } from "module" +import { execSync } from 'child_process' +import { update } from '../../other/update.js' +import { Version, Common, Plugin_Name } from '../components/index.js' /** * 全局 @@ -20,9 +23,21 @@ export class admin extends plugin { priority: 400, rule: [ { - reg: "^#椰奶(插件)?(强制)?更新", + reg: "^#椰奶(插件)?(强制)?更新$", fnc: "checkout", - } + }, + { + /** 命令正则匹配 */ + reg: '^#?椰奶(插件)?版本$', + /** 执行方法 */ + fnc: 'plugin_version', + }, + { + /** 命令正则匹配 */ + reg: '^#?椰奶(插件)?更新日志$', + /** 执行方法 */ + fnc: 'update_log', + }, ], }); this.key = "yenai:restart"; @@ -119,6 +134,28 @@ export class admin extends plugin { ); return true; } + async plugin_version() { + //await this.reply('小飞插件当前版本:'+Version.ver); + return versionInfo(this.e); + } + + async update_log() { + let Update_Plugin = new update(); + Update_Plugin.e = this.e; + Update_Plugin.reply = this.reply; + + if (Update_Plugin.getPlugin(Plugin_Name)) { + this.e.reply(await Update_Plugin.getLog(Plugin_Name)); + } + return true; + } } +async function versionInfo(e) { + return await Common.render('help/version-info', { + currentVersion: Version.ver, + changelogs: Version.logs, + elem: 'cryo' + }, { e, scale: 1.2 }) +} \ No newline at end of file diff --git a/apps/set.js b/apps/set.js index e2a6ad8..5078256 100644 --- a/apps/set.js +++ b/apps/set.js @@ -7,7 +7,7 @@ export class NewConfig extends plugin { name: '修改配置', dsc: '配置文件', event: 'message', - priority: 5000, + priority: 2000, rule: [ { /** 命令正则匹配 */ diff --git a/apps/sing.js b/apps/sing.js index 50a79bf..036a23a 100644 --- a/apps/sing.js +++ b/apps/sing.js @@ -12,7 +12,7 @@ export class example extends plugin { /** https://oicqjs.github.io/oicq/#events */ event: 'message', /** 优先级,数字越小等级越高 */ - priority: 5000, + priority: 2000, rule: [ { /** 命令正则匹配 */ diff --git a/components/common-lib/render.js b/components/common-lib/render.js index 479a55f..f38ae8f 100644 --- a/components/common-lib/render.js +++ b/components/common-lib/render.js @@ -27,7 +27,7 @@ export default async function (path, params, cfg) { }, sys: { scale: Cfg.scale(cfg.scale || 1), - copyright: `Created By Yunzai-Bot${Version.yunzai} & yenai-PluginV1.0.0` + copyright: `Created By Yunzai-Bot${Version.yunzai} & yenai-Plugin${Version.ver}` }, quality: 100 } diff --git a/index.js b/index.js index 0d5eab4..acb707f 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ const files = fs.readdirSync('./plugins/yenai-plugin/apps').filter(file => file. let ret = [] logger.info('-----------') -logger.info('椰奶插件初始化~') +logger.info('椰奶插件1.0.0初始化~') logger.info('-----------') if (!await redis.get(`yenai:notice:deltime`)) { diff --git a/resources/help/version-info.html b/resources/help/version-info.html index 97fe2cb..8844907 100644 --- a/resources/help/version-info.html +++ b/resources/help/version-info.html @@ -1,7 +1,7 @@ {{extend elemLayout}} {{block 'css'}} - + {{/block}} {{block 'main'}} @@ -11,7 +11,7 @@ {{if idx === 0 }}
当前版本 {{ds.version}}
{{else}} -
小飞版本 {{ds.version}}
+
椰奶版本 {{ds.version}}
{{/if}}