Skip to content

Commit 452bf82

Browse files
authored
Deprecate Member::distinct (#3083)
The method is just wrong. Only the username is accompanied by the discriminator, not the global name or nickname, so this method only adds confusion.
1 parent 8437326 commit 452bf82

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/model/guild/member.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ impl Member {
240240
/// Returns the DiscordTag of a Member, taking possible nickname into account.
241241
#[inline]
242242
#[must_use]
243+
#[deprecated = "Use User::tag to get the correct Discord username format or Self::display_name for the name that users will see."]
243244
pub fn distinct(&self) -> String {
244245
if let Some(discriminator) = self.user.discriminator {
245246
format!("{}#{:04}", self.display_name(), discriminator.get())

src/utils/content_safe.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ fn clean_mention(
239239
if let Some(guild) = cache.guild(guild_id) {
240240
if let Some(member) = guild.members.get(&id) {
241241
return if options.show_discriminator {
242-
format!("@{}", member.distinct())
242+
#[allow(deprecated)]
243+
let name = member.distinct();
244+
format!("@{name}")
243245
} else {
244246
format!("@{}", member.display_name())
245247
}

0 commit comments

Comments
 (0)