()
| 232 | this.enabledGroups = new Set(settings); |
| 233 | } |
| 234 | |
| 235 | // 加载每日记录 |
| 236 | const data = await this.cache.getData(); |
| 237 | if (data) { |
| 238 | if (data.last_day_check) { |
| 239 | this.lastDayCheck = data.last_day_check; |
| 240 | } |
| 241 | if (data.daily_history) { |
| 242 | for (const [gidStr, hashes] of Object.entries(data.daily_history)) { |
| 243 | const gid = Number(gidStr); |
| 244 | if (!Number.isNaN(gid)) { |
| 245 | this.dailyHistory.set(gid, new Set(hashes)); |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | if (data.trigger_config) { |
| 250 | this.triggerConfig = data.trigger_config; |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | static async setTriggerConfig(timeWindow: number, minUsers: number) { |
| 256 | this.triggerConfig = { timeWindow, minUsers }; |
| 257 | await this.cache.saveData({ trigger_config: this.triggerConfig }); |
| 258 | } |
| 259 | |
| 260 | static getTriggerConfig() { |
| 261 | return { ...this.triggerConfig }; |
| 262 | } |
no test coverage detected