| @@ -32,7 +32,15 @@ namespace Discord | |||
| /// </returns> | |||
| string Nickname { get; } | |||
| /// <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> | |||
| /// <returns> | |||
| /// The users guild avatar hash if they have one; otherwise <see langword="null"/>. | |||
| @@ -126,16 +134,29 @@ namespace Discord | |||
| /// </summary> | |||
| /// <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 | |||
| /// (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> | |||
| /// <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> | |||
| /// <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> | |||
| string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128); | |||
| /// <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. | |||
| /// </summary> | |||
| /// <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 /> | |||
| public string Nickname { get; private set; } | |||
| /// <inheritdoc/> | |||
| public string DisplayAvatarId => GuildAvatarId ?? AvatarId; | |||
| /// <inheritdoc/> | |||
| public string GuildAvatarId { get; private set; } | |||
| internal IGuild Guild { get; private set; } | |||
| /// <inheritdoc /> | |||
| @@ -183,6 +185,13 @@ namespace Discord.Rest | |||
| 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) | |||
| => CDN.GetGuildUserAvatarUrl(Id, GuildId, GuildAvatarId, size, format); | |||
| #endregion | |||
| @@ -55,9 +55,13 @@ namespace Discord.Rest | |||
| string IGuildUser.DisplayName => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.Nickname => null; | |||
| /// <inheritdoc/> | |||
| string IGuildUser.DisplayAvatarId => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.GuildAvatarId => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.GetDisplayAvatarUrl(ImageFormat format, ushort size) => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null; | |||
| /// <inheritdoc /> | |||
| bool? IGuildUser.IsPending => null; | |||
| @@ -34,6 +34,8 @@ namespace Discord.WebSocket | |||
| /// <inheritdoc /> | |||
| public string Nickname { get; private set; } | |||
| /// <inheritdoc/> | |||
| public string DisplayAvatarId => GuildAvatarId ?? AvatarId; | |||
| /// <inheritdoc/> | |||
| public string GuildAvatarId { get; private set; } | |||
| /// <inheritdoc /> | |||
| public override bool IsBot { get { return GlobalUser.IsBot; } internal set { GlobalUser.IsBot = value; } } | |||
| @@ -246,6 +248,14 @@ namespace Discord.WebSocket | |||
| /// <inheritdoc /> | |||
| public ChannelPermissions GetPermissions(IGuildChannel channel) | |||
| => 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) | |||
| => CDN.GetGuildUserAvatarUrl(Id, Guild.Id, GuildAvatarId, size, format); | |||
| @@ -58,6 +58,9 @@ namespace Discord.WebSocket | |||
| get => GuildUser.AvatarId; | |||
| internal set => GuildUser.AvatarId = value; | |||
| } | |||
| /// <inheritdoc/> | |||
| public string DisplayAvatarId => GuildAvatarId ?? AvatarId; | |||
| /// <inheritdoc/> | |||
| public string GuildAvatarId | |||
| => GuildUser.GuildAvatarId; | |||
| @@ -201,6 +204,10 @@ namespace Discord.WebSocket | |||
| /// <inheritdoc/> | |||
| 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); | |||
| internal override SocketGlobalUser GlobalUser { get => GuildUser.GlobalUser; set => GuildUser.GlobalUser = value; } | |||
| @@ -67,8 +67,12 @@ namespace Discord.WebSocket | |||
| /// <inheritdoc /> | |||
| string IGuildUser.Nickname => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.DisplayAvatarId => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.GuildAvatarId => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.GetDisplayAvatarUrl(ImageFormat format, ushort size) => null; | |||
| /// <inheritdoc /> | |||
| string IGuildUser.GetGuildAvatarUrl(ImageFormat format, ushort size) => null; | |||
| /// <inheritdoc /> | |||
| DateTimeOffset? IGuildUser.PremiumSince => null; | |||