From 072e02fb03d5bd33da25ee8bae3f16b221aea7f5 Mon Sep 17 00:00:00 2001 From: Qian23333 <119576779+Qian23333@users.noreply.github.com> Date: Sat, 16 Aug 2025 15:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=85=A8=E5=B1=80=E6=8F=90?= =?UTF-8?q?=E9=86=92=E6=97=B6=E9=97=B4=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/help.js | 13 ++++++++++--- apps/manage.js | 6 ------ apps/manage/index.js | 3 --- apps/manage/remind.js | 22 ---------------------- apps/remind.js | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 34 deletions(-) delete mode 100644 apps/manage/remind.js diff --git a/apps/help.js b/apps/help.js index 263798e..a83ec2a 100644 --- a/apps/help.js +++ b/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: '设置全局提醒时间', diff --git a/apps/manage.js b/apps/manage.js index 6f8eb55..4cd078a 100644 --- a/apps/manage.js +++ b/apps/manage.js @@ -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; } } diff --git a/apps/manage/index.js b/apps/manage/index.js index 0f01f7b..46e47d5 100644 --- a/apps/manage/index.js +++ b/apps/manage/index.js @@ -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, }; diff --git a/apps/manage/remind.js b/apps/manage/remind.js deleted file mode 100644 index 9c0e067..0000000 --- a/apps/manage/remind.js +++ /dev/null @@ -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}。`); -} \ No newline at end of file diff --git a/apps/remind.js b/apps/remind.js index 90d20cf..0e9788d 100644 --- a/apps/remind.js +++ b/apps/remind.js @@ -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}`); + } } \ No newline at end of file