fix don't mention multiple times (fix #199)
All checks were successful
PR Check / lint-and-format (pull_request) Successful in 29s
All checks were successful
PR Check / lint-and-format (pull_request) Successful in 29s
This commit is contained in:
parent
82e2f5a209
commit
399b3285df
1 changed files with 8 additions and 4 deletions
|
@ -199,16 +199,20 @@ const sendReminderAux = (client: Client, info: infoReminder, option: OptionRemin
|
||||||
// Channel
|
// Channel
|
||||||
client.channels.fetch(info.channelId!).then((channel) => {
|
client.channels.fetch(info.channelId!).then((channel) => {
|
||||||
if (channel?.isSendable()) {
|
if (channel?.isSendable()) {
|
||||||
let content = `<@${info.userId}>`;
|
const author_mention = `<@${info.userId}>`;
|
||||||
|
|
||||||
|
let content = author_mention;
|
||||||
embed.setFooter({
|
embed.setFooter({
|
||||||
text: `${loc.get("c_reminder17")} ${timeDeltaToString(info.createdAt)}`,
|
text: `${loc.get("c_reminder17")} ${timeDeltaToString(info.createdAt)}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mention everybody if needed
|
// Mention everybody if needed
|
||||||
if (option === OptionReminder.Mention) {
|
if (option === OptionReminder.Mention) {
|
||||||
(info.message?.match(/<@\d+>/g) ?? []).forEach((mention) => {
|
[...new Set(info.message?.match(/<@\d+>/g) ?? [])]
|
||||||
content += " " + mention;
|
.filter((mention) => mention !== author_mention)
|
||||||
});
|
.forEach((mention: string) => {
|
||||||
|
content += " " + mention;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.send({ content, embeds: [embed] });
|
channel.send({ content, embeds: [embed] });
|
||||||
|
|
Loading…
Reference in a new issue