feat: 版本机制; fix: fix: 绑定设备提示

This commit is contained in:
bietiaop 2024-08-20 13:29:19 +08:00
parent d34c1d8be1
commit 8425503797
16 changed files with 820 additions and 59 deletions

View file

@ -1,15 +1,8 @@
import _ from 'lodash'
import { rulePrefix } from '../lib/common.js'
import { pluginName } from '../lib/path.js'
import settings from '../lib/settings.js'
let Update = null
try {
Update = (await import("../../other/update.js").catch(e => null))?.update
Update ||= (await import("../../system/apps/update.ts")).update
} catch (e) {
logger.error(`[${pluginName}]未获取到更新js ${logger.yellow("更新功能")} 将无法使用`)
}
import _ from 'lodash';
import { rulePrefix } from '../lib/common.js';
import { pluginName } from '../lib/path.js';
import settings from '../lib/settings.js';
import { ZZZUpdate } from '../lib/update.js';
export class update extends plugin {
constructor() {
@ -23,30 +16,15 @@ export class update extends plugin {
reg: `^${rulePrefix}(插件)?(强制)?更新(插件)?$`,
fnc: 'update',
},
{
reg: `^${rulePrefix}(插件)?更新日志$`,
fnc: 'update_log',
}
],
})
});
}
async update(e = this.e) {
if (!e.isMaster) return
e.msg = `#${e.msg.includes("强制") ? "强制" : ""}更新${pluginName}`
const up = new Update(e)
up.e = e
return up.update()
}
async update_log() {
let Update_Plugin = new Update()
Update_Plugin.e = this.e
Update_Plugin.reply = this.reply
if (Update_Plugin.getPlugin(pluginName)) {
this.e.reply(await Update_Plugin.getLog(pluginName))
}
return true
if (!e.isMaster || !ZZZUpdate) return false;
e.msg = `#${e.msg.includes('强制') ? '强制' : ''}更新${pluginName}`;
const up = new ZZZUpdate(e);
up.e = e;
return up.update();
}
}