fix don't mention multiple times (fix #199)
All checks were successful
PR Check / lint-and-format (pull_request) Successful in 29s

This commit is contained in:
Mylloon 2024-10-31 17:58:54 +01:00
parent 82e2f5a209
commit 399b3285df
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -199,14 +199,18 @@ const sendReminderAux = (client: Client, info: infoReminder, option: OptionRemin
// Channel
client.channels.fetch(info.channelId!).then((channel) => {
if (channel?.isSendable()) {
let content = `<@${info.userId}>`;
const author_mention = `<@${info.userId}>`;
let content = author_mention;
embed.setFooter({
text: `${loc.get("c_reminder17")} ${timeDeltaToString(info.createdAt)}`,
});
// Mention everybody if needed
if (option === OptionReminder.Mention) {
(info.message?.match(/<@\d+>/g) ?? []).forEach((mention) => {
[...new Set(info.message?.match(/<@\d+>/g) ?? [])]
.filter((mention) => mention !== author_mention)
.forEach((mention: string) => {
content += " " + mention;
});
}