using Discord; namespace VPLink.Common.Extensions; /// /// Provides extension methods for the interface. /// public static class UserExtensions { /// /// Gets the display name of the user. /// /// The user. /// The display name. /// is null. public static string GetDisplayName(this IUser user) { 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; } }