Skip to content

Commit

Permalink
/userinfo: Handle null Display Name
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Nov 7, 2024
1 parent 0abcd8b commit 082eb19
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Helpers/UserInfoHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ public static Task<DiscordEmbed> GenerateUserInfoEmbed(DiscordUser user)
var basicUserInfoEmbed = new DiscordEmbedBuilder()
.WithThumbnail($"{user.AvatarUrl}")
.WithColor(Program.BotColor)
.AddField("ID", $"{user.Id}")
.AddField("Display Name", $"{user.GlobalName}")
.AddField("Account created on", $"<t:{createdAt}:F> (<t:{createdAt}:R>)");
.AddField("ID", $"{user.Id}");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (user.GlobalName is not null) basicUserInfoEmbed.AddField("DisplayName", user.GlobalName);
basicUserInfoEmbed.AddField("Account created on", $"<t:{createdAt}:F> (<t:{createdAt}:R>)");

var userBadges = GetBadges(user);
if (userBadges != "") basicUserInfoEmbed.AddField("Badges", userBadges);
Expand Down

0 comments on commit 082eb19

Please sign in to comment.