feat: 支持整十分钟

This commit is contained in:
Qian23333 2025-08-16 11:18:16 +08:00
parent 7359981c19
commit fcb78f2426
2 changed files with 31 additions and 13 deletions

View file

@ -6,9 +6,17 @@ export async function setGlobalRemind() {
this.reply('仅限主人设置', false, { at: true, recallMsg: 100 });
return false;
}
const match = this.e.msg.match(/设置全局提醒时间\s*(每日\d+时|每周.\d+时)/);
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}`);
}