mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-17 21:57:44 +00:00
移动全局提醒时间函数
This commit is contained in:
parent
49f9511957
commit
072e02fb03
5 changed files with 43 additions and 34 deletions
|
|
@ -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}。`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue