mirror of
https://github.com/thedrewen/protojx-manager.git
synced 2026-03-21 01:48:54 +01:00
fix(status): prevent duplicate notifications by tracking user IDs
This commit is contained in:
@@ -241,13 +241,17 @@ export class StatusService {
|
|||||||
|
|
||||||
const users = await this.followRepo.find({where: {enable: true}});
|
const users = await this.followRepo.find({where: {enable: true}});
|
||||||
const hosts = notifs.map((n) => n.host);
|
const hosts = notifs.map((n) => n.host);
|
||||||
|
const users_ids : string[] = [];
|
||||||
users.filter(v => hosts.includes(v.host)).forEach(async (user) => {
|
users.filter(v => hosts.includes(v.host)).forEach(async (user) => {
|
||||||
try {
|
if(!users_ids.includes(user.user_discord)) {
|
||||||
const userdc = await this.client?.users.fetch(user.user_discord);
|
users_ids.push(user.user_discord)
|
||||||
if(userdc) {
|
try {
|
||||||
userdc.send({components: [container], flags: [MessageFlags.IsComponentsV2]})
|
const userdc = await this.client?.users.fetch(user.user_discord);
|
||||||
}
|
if(userdc) {
|
||||||
} catch (error) {}
|
userdc.send({components: [container], flags: [MessageFlags.IsComponentsV2]})
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user