mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-17 05:37:46 +00:00
移动全局提醒时间函数
This commit is contained in:
parent
49f9511957
commit
072e02fb03
5 changed files with 43 additions and 34 deletions
13
apps/help.js
13
apps/help.js
|
|
@ -208,6 +208,13 @@ const helpData = [
|
|||
needSK: false,
|
||||
commands: ['查询挑战状态'],
|
||||
},
|
||||
{
|
||||
title: '查看提醒时间',
|
||||
desc: '查看个人提醒时间或全局提醒时间',
|
||||
needCK: true,
|
||||
needSK: false,
|
||||
commands: ['个人提醒时间', '全局提醒时间']
|
||||
},
|
||||
{
|
||||
title: '设置个人提醒时间',
|
||||
desc: '设置每日或每周的个人提醒时间,格式如“每日20时”或“每周六20时10分”,分钟需为整十数,可不加分钟。',
|
||||
|
|
@ -216,11 +223,11 @@ const helpData = [
|
|||
commands: ['设置个人提醒时间+时间'],
|
||||
},
|
||||
{
|
||||
title: '查看/取消个人提醒时间',
|
||||
desc: '查看当前个人提醒时间或取消已设置的个人提醒时间',
|
||||
title: '取消个人提醒时间',
|
||||
desc: '取消已设置的个人提醒时间',
|
||||
needCK: true,
|
||||
needSK: false,
|
||||
commands: ['个人提醒时间', '取消个人提醒时间'],
|
||||
commands: ['取消个人提醒时间'],
|
||||
},
|
||||
{
|
||||
title: '设置全局提醒时间',
|
||||
|
|
|
|||
|
|
@ -88,11 +88,6 @@ export class Manage extends ZZZPlugin {
|
|||
reg: `${rulePrefix}设置检查更新时间(.+)$`,
|
||||
fnc: 'setCheckUpdateCron',
|
||||
},
|
||||
{
|
||||
reg: `${rulePrefix}设置全局提醒时间\\s*(每日\\d+时|每周.\\d+时)`,
|
||||
fnc: 'setGlobalRemind',
|
||||
permission: 'master',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
|
@ -116,6 +111,5 @@ export class Manage extends ZZZPlugin {
|
|||
this.setCheckUpdateCron = manage.version.setCheckUpdateCron;
|
||||
this.setDefaultDevice = manage.device.setDefaultDevice;
|
||||
this.toSetDefaultDevice = manage.device.toSetDefaultDevice;
|
||||
this.setGlobalRemind = manage.remind.setGlobalRemind;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import * as version from './version.js';
|
|||
|
||||
import * as device from './device.js';
|
||||
|
||||
import * as remind from './remind.js';
|
||||
|
||||
export default {
|
||||
assets,
|
||||
guides,
|
||||
|
|
@ -22,5 +20,4 @@ export default {
|
|||
panel,
|
||||
version,
|
||||
device,
|
||||
remind,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
import settings from '../../lib/settings.js';
|
||||
|
||||
/** 设置全局提醒时间 */
|
||||
export async function setGlobalRemind() {
|
||||
if (!this.e.isMaster) {
|
||||
this.reply('仅限主人设置', false, { at: true, recallMsg: 100 });
|
||||
return false;
|
||||
}
|
||||
const match = this.e.msg.match(/设置全局提醒时间\s*(每日\d+时(?:(\d+)分)?)|每周.\d+时(?:(\d+)分)?))/);
|
||||
if (!match) return;
|
||||
const remindTime = match[1];
|
||||
const minute = Number(match[2]) || Number(match[3]) || 0;
|
||||
|
||||
// 验证分钟格式
|
||||
if (minute % 10 !== 0 || minute < 0 || minute >= 60) {
|
||||
await this.reply('分钟必须为整十分钟');
|
||||
return;
|
||||
}
|
||||
|
||||
settings.setSingleConfig('remind', 'globalRemindTime', remindTime);
|
||||
await this.reply(`全局提醒时间已更新为: ${remindTime}。`);
|
||||
}
|
||||
|
|
@ -47,6 +47,14 @@ export class Remind extends ZZZPlugin {
|
|||
reg: `${rulePrefix}取消个人提醒时间`,
|
||||
fnc: 'deleteMyRemindTime',
|
||||
},
|
||||
{
|
||||
reg: `${rulePrefix}设置全局提醒时间\\s*(每日\\d+时(?:(\\d+)分)?|每周.\\d+时(?:(\\d+)分)?)`,
|
||||
fnc: 'setGlobalRemindTime',
|
||||
},
|
||||
{
|
||||
reg: `${rulePrefix}全局提醒时间$`,
|
||||
fnc: 'viewGlobalRemindTime',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
|
@ -349,4 +357,29 @@ export class Remind extends ZZZPlugin {
|
|||
await this.reply('个人提醒时间尚未设置');
|
||||
}
|
||||
}
|
||||
|
||||
async setGlobalRemindTime() {
|
||||
if (!this.e.isMaster) {
|
||||
this.reply('仅限主人设置', false, { at: true, recallMsg: 100 });
|
||||
return false;
|
||||
}
|
||||
const match = this.e.msg.match(/设置全局提醒时间\s*(每日\d+时(?:(\d+)分)?)|每周.\d+时(?:(\d+)分)?))/);
|
||||
if (!match) return;
|
||||
const globalRemindTime = match[1];
|
||||
const minute = Number(match[2]) || Number(match[3]) || 0;
|
||||
|
||||
// 验证分钟格式
|
||||
if (minute % 10 !== 0 || minute < 0 || minute >= 60) {
|
||||
await this.reply('分钟必须为整十分钟');
|
||||
return;
|
||||
}
|
||||
|
||||
settings.setSingleConfig('remind', 'globalRemindTime', globalRemindTime);
|
||||
await this.reply(`全局提醒时间已更新为: ${globalRemindTime}。`);
|
||||
}
|
||||
|
||||
async viewGlobalRemindTime() {
|
||||
const globalRemindTime = settings.getConfig('remind').globalRemindTime || '每日20时';
|
||||
await this.reply(`当前全局提醒时间: ${globalRemindTime}`);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue