fix: 修复全局时间配置和获取

This commit is contained in:
Qian23333 2025-08-16 07:23:48 +08:00
parent 40bfbda264
commit 22711ee7b1
2 changed files with 5 additions and 3 deletions

View file

@ -10,7 +10,8 @@ export async function setGlobalRemind() {
if (!match) return; if (!match) return;
const remindTime = match[1]; const remindTime = match[1];
// 将全局提醒时间写入yaml配置 // 使用 setSingleConfig 更新特定字段
settings.setConfig('remind.globalRemindTime', remindTime); settings.setSingleConfig('remind', 'globalRemindTime', remindTime);
await this.reply(`全局提醒时间已更新为: ${remindTime}`); await this.reply(`全局提醒时间已更新为: ${remindTime}`);
} }

View file

@ -301,7 +301,8 @@ export class Remind extends ZZZPlugin {
if (userConfig && userConfig.remindTime) { if (userConfig && userConfig.remindTime) {
await this.reply(`当前提醒时间: ${userConfig.remindTime}`); await this.reply(`当前提醒时间: ${userConfig.remindTime}`);
} else { } else {
const globalRemindTime = settings.getConfig('remind.globalRemindTime') || '每日20时'; const remindConfig = settings.getConfig('remind');
const globalRemindTime = remindConfig.globalRemindTime || '每日20时';
await this.reply(`个人提醒时间未设置,默认使用全局时间: ${globalRemindTime}`); await this.reply(`个人提醒时间未设置,默认使用全局时间: ${globalRemindTime}`);
} }
} }