Skip to content

Commit

Permalink
fix: Add default avatar to WithAuthor extension (#1890)
Browse files Browse the repository at this point in the history
Adds `??  user.GetDefaultAvatarUrl()` to the avatar icon field.
  • Loading branch information
quinchs committed Jul 10, 2021
1 parent c5b4b64 commit c200861
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class EmbedBuilderExtensions

/// <summary> Fills the embed author field with the provided user's full username and avatar URL. </summary>
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IUser user) =>
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl());
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl() ?? user.GetDefaultAvatarUrl());

/// <summary> Converts a <see cref="EmbedType.Rich"/> <see cref="IEmbed"/> object to a <see cref="EmbedBuilder"/>. </summary>
/// <exception cref="InvalidOperationException">The embed type is not <see cref="EmbedType.Rich"/>.</exception>
Expand Down

0 comments on commit c200861

Please sign in to comment.