From 956536a7176c0f5368f850da57a6931754e254b0 Mon Sep 17 00:00:00 2001 From: CL TheDreWen Date: Mon, 3 Nov 2025 11:53:02 +0100 Subject: [PATCH] fix(status): prevent duplicate notifications by tracking user IDs --- src/services/status.service.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/services/status.service.ts b/src/services/status.service.ts index 019fcf2..7670b44 100644 --- a/src/services/status.service.ts +++ b/src/services/status.service.ts @@ -241,13 +241,17 @@ export class StatusService { const users = await this.followRepo.find({where: {enable: true}}); const hosts = notifs.map((n) => n.host); + const users_ids : string[] = []; users.filter(v => hosts.includes(v.host)).forEach(async (user) => { - try { - const userdc = await this.client?.users.fetch(user.user_discord); - if(userdc) { - userdc.send({components: [container], flags: [MessageFlags.IsComponentsV2]}) - } - } catch (error) {} + if(!users_ids.includes(user.user_discord)) { + users_ids.push(user.user_discord) + try { + const userdc = await this.client?.users.fetch(user.user_discord); + if(userdc) { + userdc.send({components: [container], flags: [MessageFlags.IsComponentsV2]}) + } + } catch (error) {} + } }); } }