diff --git a/src/discord/commands/tag_notify.rs b/src/discord/commands/tag_notify.rs index f09c2d0..40f602e 100644 --- a/src/discord/commands/tag_notify.rs +++ b/src/discord/commands/tag_notify.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::{collections::HashSet, sync::Arc}; use log::debug; @@ -99,6 +99,7 @@ impl BotCommand for TagNotifyCommand { let user_selection = selector.get_user_selection().await?; if let Some(selection) = user_selection { + let mut users_to_ping: HashSet = HashSet::new(); let mut answer = String::new(); for selected_tag in selection { let t = match guild.tags.iter().find(|s| s.name == selected_tag) { @@ -112,7 +113,7 @@ impl BotCommand for TagNotifyCommand { match user_id.parse::() { Ok(id) => match &UserId(id).to_user(&context).await { Ok(e) => { - answer += &e.mention().to_string(); + users_to_ping.insert(e.mention().to_string()); } Err(_e) => {} }, @@ -120,6 +121,11 @@ impl BotCommand for TagNotifyCommand { } } } + + for user in users_to_ping { + answer.push_str(user.as_str()); + } + let mut response = match self.interaction.get_interaction_response(&context).await { Ok(r) => Ok(r), Err(_e) => Err(CommandExecutionError::ContextRetrievalError(