(now: number)
| 390 | const valid = msgs.filter(m => now - m.time <= this.triggerConfig.timeWindow); |
| 391 | if (valid.length === 0) { |
| 392 | this.recentMessages.delete(gid); |
| 393 | } else { |
| 394 | this.recentMessages.set(gid, valid); |
| 395 | } |
| 396 | } |
| 397 | this.lastCleanup = now; |
| 398 | } |
| 399 | |
| 400 | // 每天重置复读记录 |
| 401 | const dayKey = Math.floor((now + 8 * 3600) / 86400); // UTC+8 天数 |
| 402 | if (dayKey > this.lastDayCheck) { |
| 403 | this.dailyHistory.clear(); |
| 404 | this.lastDayCheck = dayKey; |
| 405 | this.saveDailyHistory(); // 保存新的天数和空的记录 |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | static cleanup(): void { |
| 410 | this.recentMessages.clear(); |
| 411 | this.dailyHistory.clear(); |
| 412 | this.enabledGroups.clear(); |
| 413 | this.lastCleanup = 0; |
| 414 | this.lastDayCheck = 0; |
| 415 | } |
| 416 | } |
no test coverage detected