From ff3ed3963df9b5d7b259f2900485432f80fe00c9 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 17 Oct 2023 07:04:13 +0200 Subject: [PATCH] add AvatarDecorationUrl --- DisCatSharp/Entities/User/DiscordUser.cs | 10 ++++++++-- DisCatSharp/Net/Rest/Endpoints.cs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DisCatSharp/Entities/User/DiscordUser.cs b/DisCatSharp/Entities/User/DiscordUser.cs index 6744566bf..df61dbbbb 100644 --- a/DisCatSharp/Entities/User/DiscordUser.cs +++ b/DisCatSharp/Entities/User/DiscordUser.cs @@ -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"; - /*/// + /// /// Gets the user's avatar decoration url. /// [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; /// /// Gets the URL of default avatar for this user. @@ -585,6 +585,12 @@ public class AvatarDecorationData [JsonProperty("asset", NullValueHandling = NullValueHandling.Ignore)] public string Asset { get; internal set; } + /// + /// Gets the user's avatar decoration url. + /// + [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; } } diff --git a/DisCatSharp/Net/Rest/Endpoints.cs b/DisCatSharp/Net/Rest/Endpoints.cs index a5fa70f0e..0e31e533c 100644 --- a/DisCatSharp/Net/Rest/Endpoints.cs +++ b/DisCatSharp/Net/Rest/Endpoints.cs @@ -202,7 +202,7 @@ public static class Endpoints /// /// The avatar decorations endpoint. /// - public const string AVATARS_DECORATIONS = "/avatars-decorations"; + public const string AVATARS_DECORATION_PRESETS = "/avatar-decoration-presets"; /// /// The bans endpoint.