style: surround bot names with [ ]

This commit is contained in:
Oliver Booth 2023-08-27 17:00:30 +01:00
parent 6193e5ddf7
commit 1491f7fd86
Signed by: oliverbooth
GPG Key ID: B89D139977693FED
1 changed files with 3 additions and 1 deletions

View File

@ -15,11 +15,13 @@ public static class UserExtensions
/// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
public static string GetDisplayName(this IUser user)
{
return user switch
string displayName = user switch
{
null => throw new ArgumentNullException(nameof(user)),
IGuildUser member => member.Nickname ?? member.GlobalName ?? member.Username,
_ => user.GlobalName ?? user.Username
};
return user.IsBot ? $"[{displayName}]" : displayName;
}
}