feat(services): implement periodic booster role cleanup

Add a new `boostCleanupService` to periodically scan guilds and remove
custom booster roles and database records for members who are no longer
eligible (e.g., lost boost status or left the server). This ensures
data consistency even if the bot was offline during status changes.

- Implement `startBoostCleanup` with configurable intervals
- Add `findByGuild` to `BoosterRoleStore` for batch processing
- Update `DrizzleBoosterRoleStore` to support guild-based lookups
- Add configuration for `boostCleanupIntervalMs`
This commit is contained in:
MythEclipse
2026-06-06 02:46:38 +07:00
parent 01450d976c
commit 57699d60a8
6 changed files with 142 additions and 7 deletions
+4
View File
@@ -8,6 +8,10 @@ class MemoryRoleStore {
return this.records.get(`${guildId}:${userId}`) ?? null;
}
async findByGuild(guildId: string): Promise<BoosterRoleRecord[]> {
return Array.from(this.records.values()).filter((r) => r.guildId === guildId);
}
async create(record: BoosterRoleRecord): Promise<void> {
this.records.set(`${record.guildId}:${record.userId}`, record);
}