Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate Member::distinct #3083

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/model/guild/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 3 additions & 1 deletion src/utils/content_safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
Loading