[Feature] Avatar decorations support (#2782)
* yup * nullable... * add props & methos to `GuildUser` & `IUser`
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using EventUserModel = Discord.API.GuildScheduledEventUser;
|
||||
using Model = Discord.API.User;
|
||||
|
||||
@@ -50,6 +51,13 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
public virtual bool IsWebhook => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string AvatarDecorationHash { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ulong? AvatarDecorationSkuId { get; private set; }
|
||||
|
||||
|
||||
internal RestUser(BaseDiscordClient discord, ulong id)
|
||||
: base(discord, id)
|
||||
{
|
||||
@@ -96,6 +104,11 @@ namespace Discord.Rest
|
||||
PublicFlags = model.PublicFlags.Value;
|
||||
if (model.GlobalName.IsSpecified)
|
||||
GlobalName = model.GlobalName.Value;
|
||||
if (model.AvatarDecoration is { IsSpecified: true, Value: not null })
|
||||
{
|
||||
AvatarDecorationHash = model.AvatarDecoration.Value?.Asset;
|
||||
AvatarDecorationSkuId = model.AvatarDecoration.Value?.SkuId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -129,6 +142,12 @@ namespace Discord.Rest
|
||||
? CDN.GetDefaultUserAvatarUrl(DiscriminatorValue)
|
||||
: CDN.GetDefaultUserAvatarUrl(Id);
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetAvatarDecorationUrl()
|
||||
=> AvatarDecorationHash is not null
|
||||
? CDN.GetAvatarDecorationUrl(AvatarDecorationHash)
|
||||
: null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Username#Discriminator of the user.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user