[Refactor] Extract GetDisplayAvatarUrl in IUser (#2771)
* Implement `GetDisplayAvatarUrl` method * Remove obsolete example * Update XML documentation --------- Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
@@ -194,15 +194,13 @@ namespace Discord.Rest
|
||||
return new ChannelPermissions(Permissions.ResolveChannel(Guild, this, channel, guildPerms.RawValue));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> GuildAvatarId is not null
|
||||
? GetGuildAvatarUrl(format, size)
|
||||
: GetAvatarUrl(format, size);
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> CDN.GetGuildUserAvatarUrl(Id, GuildId, GuildAvatarId, size, format);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> GetGuildAvatarUrl(format, size) ?? base.GetDisplayAvatarUrl(format, size);
|
||||
#endregion
|
||||
|
||||
#region IGuildUser
|
||||
|
||||
@@ -142,6 +142,9 @@ namespace Discord.Rest
|
||||
? CDN.GetDefaultUserAvatarUrl(DiscriminatorValue)
|
||||
: CDN.GetDefaultUserAvatarUrl(Id);
|
||||
|
||||
public virtual string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
|
||||
=> GetAvatarUrl(format, size) ?? GetDefaultAvatarUrl();
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetAvatarDecorationUrl()
|
||||
=> AvatarDecorationHash is not null
|
||||
|
||||
@@ -60,8 +60,6 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
string IGuildUser.GuildAvatarId => null;
|
||||
/// <inheritdoc />
|
||||
string IGuildUser.GetDisplayAvatarUrl(ImageFormat format, ushort size) => null;
|
||||
/// <inheritdoc />
|
||||
string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null;
|
||||
/// <inheritdoc />
|
||||
bool? IGuildUser.IsPending => null;
|
||||
|
||||
Reference in New Issue
Block a user