From 4d5fc172643437fa09338a6cea65ac3a2606f5c8 Mon Sep 17 00:00:00 2001 From: jamesbt365 Date: Thu, 12 Dec 2024 00:08:28 +0000 Subject: [PATCH] deprecate Member::distinct --- src/model/guild/member.rs | 1 + src/utils/content_safe.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/model/guild/member.rs b/src/model/guild/member.rs index 76fbc69fe10..e1ac4631dfd 100644 --- a/src/model/guild/member.rs +++ b/src/model/guild/member.rs @@ -240,6 +240,7 @@ impl Member { /// Returns the DiscordTag of a Member, taking possible nickname into account. #[inline] #[must_use] + #[deprecated = "Use User::tag to get the correct Discord username format or Self::display_name for the name that users will see."] pub fn distinct(&self) -> String { if let Some(discriminator) = self.user.discriminator { format!("{}#{:04}", self.display_name(), discriminator.get()) diff --git a/src/utils/content_safe.rs b/src/utils/content_safe.rs index 43ce0e23fd1..f3d34cec688 100644 --- a/src/utils/content_safe.rs +++ b/src/utils/content_safe.rs @@ -239,7 +239,9 @@ fn clean_mention( if let Some(guild) = cache.guild(guild_id) { if let Some(member) = guild.members.get(&id) { return if options.show_discriminator { - format!("@{}", member.distinct()) + #[allow(deprecated)] + let name = member.distinct(); + format!("@{name}") } else { format!("@{}", member.display_name()) }