mirror of https://github.com/oliverbooth/VPLink
style: surround bot names with [ ]
This commit is contained in:
parent
6193e5ddf7
commit
1491f7fd86
|
@ -15,11 +15,13 @@ public static class UserExtensions
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
|
/// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
|
||||||
public static string GetDisplayName(this IUser user)
|
public static string GetDisplayName(this IUser user)
|
||||||
{
|
{
|
||||||
return user switch
|
string displayName = user switch
|
||||||
{
|
{
|
||||||
null => throw new ArgumentNullException(nameof(user)),
|
null => throw new ArgumentNullException(nameof(user)),
|
||||||
IGuildUser member => member.Nickname ?? member.GlobalName ?? member.Username,
|
IGuildUser member => member.Nickname ?? member.GlobalName ?? member.Username,
|
||||||
_ => user.GlobalName ?? user.Username
|
_ => user.GlobalName ?? user.Username
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return user.IsBot ? $"[{displayName}]" : displayName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue