@@ -32,7 +32,15 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
string Nickname { get; } | string Nickname { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the guild specific avatar for this users. | |||||
/// Gets the displayed avatar for this user. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// The users displayed avatar hash. If the user does not have a guild avatar, this will be the regular avatar. | |||||
/// If the user also does not have a regular avatar, this will be <see langword="null"/>. | |||||
/// </returns> | |||||
string DisplayAvatarId { get; } | |||||
/// <summary> | |||||
/// Gets the guild specific avatar for this user. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// The users guild avatar hash if they have one; otherwise <see langword="null"/>. | /// The users guild avatar hash if they have one; otherwise <see langword="null"/>. | ||||
@@ -126,16 +134,29 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// This property retrieves a URL for this guild user's guild specific avatar. In event that the user does not have a valid guild avatar | /// This property retrieves a URL for this guild user's guild specific avatar. In event that the user does not have a valid guild avatar | ||||
/// (i.e. their avatar identifier is not set), this method will return <c>null</c>. | |||||
/// (i.e. their avatar identifier is not set), this method will return <see langword="null"/>. | |||||
/// </remarks> | /// </remarks> | ||||
/// <param name="format">The format to return.</param> | /// <param name="format">The format to return.</param> | ||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048. | /// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048. | ||||
/// </param> | /// </param> | ||||
/// <returns> | /// <returns> | ||||
/// A string representing the user's avatar URL; <c>null</c> if the user does not have an avatar in place. | |||||
/// A string representing the user's avatar URL; <see langword="null"/> if the user does not have an avatar in place. | |||||
/// </returns> | /// </returns> | ||||
string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the display avatar URL for this user. | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// This property retrieves an URL for this guild user's displayed avatar. | |||||
/// If the user does not have a guild avatar, this will be the user's regular avatar. | |||||
/// </remarks> | |||||
/// <param name="format">The format to return.</param> | |||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048. | |||||
/// <returns> | |||||
/// A string representing the URL of the displayed avatar for this user. <see langword="null"/> if the user does not have an avatar in place. | |||||
/// </returns> | |||||
string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||||
/// <summary> | |||||
/// Kicks this user from this guild. | /// Kicks this user from this guild. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="reason">The reason for the kick which will be recorded in the audit log.</param> | /// <param name="reason">The reason for the kick which will be recorded in the audit log.</param> | ||||
@@ -24,6 +24,8 @@ namespace Discord.Rest | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Nickname { get; private set; } | public string Nickname { get; private set; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string DisplayAvatarId => GuildAvatarId ?? AvatarId; | |||||
/// <inheritdoc/> | |||||
public string GuildAvatarId { get; private set; } | public string GuildAvatarId { get; private set; } | ||||
internal IGuild Guild { get; private set; } | internal IGuild Guild { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -183,6 +185,13 @@ namespace Discord.Rest | |||||
return new ChannelPermissions(Permissions.ResolveChannel(Guild, this, channel, guildPerms.RawValue)); | 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) | public string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
=> CDN.GetGuildUserAvatarUrl(Id, GuildId, GuildAvatarId, size, format); | => CDN.GetGuildUserAvatarUrl(Id, GuildId, GuildAvatarId, size, format); | ||||
#endregion | #endregion | ||||
@@ -55,9 +55,13 @@ namespace Discord.Rest | |||||
string IGuildUser.DisplayName => null; | string IGuildUser.DisplayName => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
string IGuildUser.Nickname => null; | string IGuildUser.Nickname => null; | ||||
/// <inheritdoc/> | |||||
string IGuildUser.DisplayAvatarId => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
string IGuildUser.GuildAvatarId => null; | string IGuildUser.GuildAvatarId => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
string IGuildUser.GetDisplayAvatarUrl(ImageFormat format, ushort size) => null; | |||||
/// <inheritdoc /> | |||||
string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null; | string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
bool? IGuildUser.IsPending => null; | bool? IGuildUser.IsPending => null; | ||||
@@ -34,6 +34,8 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Nickname { get; private set; } | public string Nickname { get; private set; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string DisplayAvatarId => GuildAvatarId ?? AvatarId; | |||||
/// <inheritdoc/> | |||||
public string GuildAvatarId { get; private set; } | public string GuildAvatarId { get; private set; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public override bool IsBot { get { return GlobalUser.IsBot; } internal set { GlobalUser.IsBot = value; } } | public override bool IsBot { get { return GlobalUser.IsBot; } internal set { GlobalUser.IsBot = value; } } | ||||
@@ -246,6 +248,14 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ChannelPermissions GetPermissions(IGuildChannel channel) | public ChannelPermissions GetPermissions(IGuildChannel channel) | ||||
=> new ChannelPermissions(Permissions.ResolveChannel(Guild, this, channel, GuildPermissions.RawValue)); | => new ChannelPermissions(Permissions.ResolveChannel(Guild, this, channel, GuildPermissions.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) | public string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
=> CDN.GetGuildUserAvatarUrl(Id, Guild.Id, GuildAvatarId, size, format); | => CDN.GetGuildUserAvatarUrl(Id, Guild.Id, GuildAvatarId, size, format); | ||||
@@ -58,6 +58,9 @@ namespace Discord.WebSocket | |||||
get => GuildUser.AvatarId; | get => GuildUser.AvatarId; | ||||
internal set => GuildUser.AvatarId = value; | internal set => GuildUser.AvatarId = value; | ||||
} | } | ||||
/// <inheritdoc/> | |||||
public string DisplayAvatarId => GuildAvatarId ?? AvatarId; | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string GuildAvatarId | public string GuildAvatarId | ||||
=> GuildUser.GuildAvatarId; | => GuildUser.GuildAvatarId; | ||||
@@ -201,6 +204,10 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
IReadOnlyCollection<ulong> IGuildUser.RoleIds => GuildUser.Roles.Select(x => x.Id).ToImmutableArray(); | IReadOnlyCollection<ulong> IGuildUser.RoleIds => GuildUser.Roles.Select(x => x.Id).ToImmutableArray(); | ||||
/// <inheritdoc /> | |||||
string IGuildUser.GetDisplayAvatarUrl(ImageFormat format, ushort size) => GuildUser.GetDisplayAvatarUrl(format, size); | |||||
/// <inheritdoc /> | |||||
string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => GuildUser.GetGuildAvatarUrl(format, size); | string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => GuildUser.GetGuildAvatarUrl(format, size); | ||||
internal override SocketGlobalUser GlobalUser { get => GuildUser.GlobalUser; set => GuildUser.GlobalUser = value; } | internal override SocketGlobalUser GlobalUser { get => GuildUser.GlobalUser; set => GuildUser.GlobalUser = value; } | ||||
@@ -67,8 +67,12 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
string IGuildUser.Nickname => null; | string IGuildUser.Nickname => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
string IGuildUser.DisplayAvatarId => null; | |||||
/// <inheritdoc /> | |||||
string IGuildUser.GuildAvatarId => null; | string IGuildUser.GuildAvatarId => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
string IGuildUser.GetDisplayAvatarUrl(ImageFormat format, ushort size) => null; | |||||
/// <inheritdoc /> | |||||
string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null; | string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
DateTimeOffset? IGuildUser.PremiumSince => null; | DateTimeOffset? IGuildUser.PremiumSince => null; | ||||