Browse Source

fix: Add default avatar to WithAuthor extension (#1890)

Adds `??  user.GetDefaultAvatarUrl()` to the avatar icon field.
tags/3.0.0
Quin Lynch GitHub 3 years ago
parent
commit
c200861585
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs

+ 1
- 1
src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs View File

@@ -27,7 +27,7 @@ namespace Discord

/// <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>


Loading…
Cancel
Save