mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-17 21:57:44 +00:00
fix: 默认关闭更新推送
This commit is contained in:
parent
fa4ff5b64c
commit
a25a9b4d9b
3 changed files with 14 additions and 12 deletions
12
apps/help.js
12
apps/help.js
|
|
@ -332,18 +332,18 @@ export class Help extends ZZZPlugin {
|
||||||
commands: ['设置默认设备'],
|
commands: ['设置默认设备'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '开启/关闭自动更新推送',
|
title: '开启/关闭更新推送',
|
||||||
desc: '开启/关闭自动更新推送,自动更新仅推送给第一个主人',
|
desc: '开启/关闭更新推送,更新仅推送给第一个主人',
|
||||||
needCK: false,
|
needCK: false,
|
||||||
needSK: false,
|
needSK: false,
|
||||||
commands: ['开启/关闭自动更新'],
|
commands: ['开启/关闭更新推送'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设置自动更新时间',
|
title: '设置检查自动更新时间',
|
||||||
desc: '设置自动更新时间,cron表达式,如0 0/10 * * * ?',
|
desc: '设置检查自动更新时间,cron表达式,如0 0/10 * * * ?',
|
||||||
needCK: false,
|
needCK: false,
|
||||||
needSK: false,
|
needSK: false,
|
||||||
commands: ['设置自动更新时间+cron表达式'],
|
commands: ['设置检查更新时间+cron表达式'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,11 @@ export class Panel extends ZZZPlugin {
|
||||||
fnc: 'setDefaultDevice',
|
fnc: 'setDefaultDevice',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: `${rulePrefix}(开启|关闭)自动更新$`,
|
reg: `${rulePrefix}(开启|关闭)更新推送$`,
|
||||||
fnc: 'enableAutoUpdatePush',
|
fnc: 'enableAutoUpdatePush',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: `${rulePrefix}设置自动更新时间(.+)$`,
|
reg: `${rulePrefix}设置检查更新时间(.+)$`,
|
||||||
fnc: 'setCheckUpdateCron',
|
fnc: 'setCheckUpdateCron',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import { ZZZUpdate } from '../lib/update.js';
|
||||||
import config from '../../../lib/config/config.js';
|
import config from '../../../lib/config/config.js';
|
||||||
import { rulePrefix } from '../lib/common.js';
|
import { rulePrefix } from '../lib/common.js';
|
||||||
|
|
||||||
const lastNotify = '';
|
const updateInfo = {
|
||||||
|
lastCheckCommit: '',
|
||||||
|
};
|
||||||
export class update extends plugin {
|
export class update extends plugin {
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
|
|
@ -41,13 +43,13 @@ export class update extends plugin {
|
||||||
|
|
||||||
async checkUpdateTask() {
|
async checkUpdateTask() {
|
||||||
const updateConfig = _.get(settings.getConfig('config'), 'update', {});
|
const updateConfig = _.get(settings.getConfig('config'), 'update', {});
|
||||||
const enable = _.get(updateConfig, 'autoCheck', true);
|
const enable = _.get(updateConfig, 'autoCheck', false);
|
||||||
if (!enable) return;
|
if (!enable) return;
|
||||||
if (!ZZZUpdate) return false;
|
if (!ZZZUpdate) return false;
|
||||||
const up = new ZZZUpdate();
|
const up = new ZZZUpdate();
|
||||||
const result = await up.hasUpdate();
|
const result = await up.hasUpdate();
|
||||||
if (result.hasUpdate) {
|
if (result.hasUpdate) {
|
||||||
if (result.logs[0].commit === lastNotify) return;
|
if (result.logs[0].commit === updateInfo.lastCheckCommit) return;
|
||||||
const botInfo = { nickname: 'ZZZ-Plugin更新', user_id: Bot.uin };
|
const botInfo = { nickname: 'ZZZ-Plugin更新', user_id: Bot.uin };
|
||||||
const msgs = [
|
const msgs = [
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +79,7 @@ export class update extends plugin {
|
||||||
await Bot.pickFriend(master).sendMsg(msg);
|
await Bot.pickFriend(master).sendMsg(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lastNotify = result.logs[0].commit;
|
updateInfo.lastCheckCommit = result.logs[0].commit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue