Skip to content

Commit

Permalink
add AvatarDecorationUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Oct 17, 2023
1 parent 455c5cb commit ff3ed39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions DisCatSharp/Entities/User/DiscordUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ public string ProfileUrl
public string AvatarUrl
=> string.IsNullOrWhiteSpace(this.AvatarHash) ? this.DefaultAvatarUrl : $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.AVATARS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.AvatarHash}.{(this.AvatarHash.StartsWith("a_") ? "gif" : "png")}?size=1024";

/*/// <summary>
/// <summary>
/// Gets the user's avatar decoration url.
/// </summary>
[JsonIgnore]
public string? AvatarDecorationUrl => string.IsNullOrWhiteSpace(this.AvatarDecorationHash) ? null : $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.AVATARS_DECORATIONS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.AvatarDecorationHash}.{(this.AvatarDecorationHash.StartsWith("a_") ? "gif" : "png")}?size=1024";*/
public string? AvatarDecorationUrl => this.AvatarDecorationData?.AssetUrl;

/// <summary>
/// Gets the URL of default avatar for this user.
Expand Down Expand Up @@ -585,6 +585,12 @@ public class AvatarDecorationData
[JsonProperty("asset", NullValueHandling = NullValueHandling.Ignore)]
public string Asset { get; internal set; }

/// <summary>
/// Gets the user's avatar decoration url.
/// </summary>
[JsonIgnore]
public string? AssetUrl => string.IsNullOrWhiteSpace(this.Asset) ? null : $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.AVATARS_DECORATION_PRESETS}/{this.Asset}.png?size=1024";

[JsonProperty("sku_id", NullValueHandling = NullValueHandling.Ignore)]
public ulong SkuId { get; internal set; }
}
Expand Down
2 changes: 1 addition & 1 deletion DisCatSharp/Net/Rest/Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static class Endpoints
/// <summary>
/// The avatar decorations endpoint.
/// </summary>
public const string AVATARS_DECORATIONS = "/avatars-decorations";
public const string AVATARS_DECORATION_PRESETS = "/avatar-decoration-presets";

/// <summary>
/// The bans endpoint.
Expand Down

0 comments on commit ff3ed39

Please sign in to comment.