[Feature] Avatar decorations support (#2782)
* yup * nullable... * add props & methos to `GuildUser` & `IUser`
This commit is contained in:
@@ -47,6 +47,13 @@ namespace Discord.WebSocket
|
||||
public IReadOnlyCollection<ClientType> ActiveClients => Presence.ActiveClients ?? ImmutableHashSet<ClientType>.Empty;
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyCollection<IActivity> Activities => Presence.Activities ?? ImmutableList<IActivity>.Empty;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string AvatarDecorationHash { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public ulong? AvatarDecorationSkuId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets mutual guilds shared with this user.
|
||||
/// </summary>
|
||||
@@ -98,6 +105,14 @@ namespace Discord.WebSocket
|
||||
GlobalName = model.GlobalName.Value;
|
||||
hasChanges = true;
|
||||
}
|
||||
if (model.AvatarDecoration is { IsSpecified: true, Value: not null }
|
||||
&& (model.AvatarDecoration.Value.Asset != AvatarDecorationHash || model.AvatarDecoration.Value.SkuId != AvatarDecorationSkuId))
|
||||
{
|
||||
AvatarDecorationHash = model.AvatarDecoration.Value?.Asset;
|
||||
AvatarDecorationSkuId = model.AvatarDecoration.Value?.SkuId;
|
||||
hasChanges = true;
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
|
||||
@@ -121,6 +136,12 @@ namespace Discord.WebSocket
|
||||
? CDN.GetDefaultUserAvatarUrl(DiscriminatorValue)
|
||||
: CDN.GetDefaultUserAvatarUrl(Id);
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetAvatarDecorationUrl()
|
||||
=> AvatarDecorationHash is not null
|
||||
? CDN.GetAvatarDecorationUrl(AvatarDecorationHash)
|
||||
: null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full name of the user (e.g. Example#0001).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user