diff --git a/src/Discord.Net.Core/CDN.cs b/src/Discord.Net.Core/CDN.cs index f46a0697f..d6535a4f1 100644 --- a/src/Discord.Net.Core/CDN.cs +++ b/src/Discord.Net.Core/CDN.cs @@ -139,15 +139,17 @@ namespace Discord /// /// The guild snowflake identifier. /// The banner image identifier. + /// The format to return. /// The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048 inclusive. /// /// A URL pointing to the guild's banner image. /// - public static string GetGuildBannerUrl(ulong guildId, string bannerId, ushort? size = null) + public static string GetGuildBannerUrl(ulong guildId, string bannerId, ImageFormat format, ushort? size = null) { - if (!string.IsNullOrEmpty(bannerId)) - return $"{DiscordConfig.CDNUrl}banners/{guildId}/{bannerId}.jpg" + (size.HasValue ? $"?size={size}" : string.Empty); - return null; + if (string.IsNullOrEmpty(bannerId)) + return null; + string extension = FormatToExtension(format, bannerId); + return $"{DiscordConfig.CDNUrl}banners/{guildId}/{bannerId}.{extension}" + (size.HasValue ? $"?size={size}" : string.Empty); } /// /// Returns an emoji URL. diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index 8b0659baf..d90ba9ada 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -102,7 +102,7 @@ namespace Discord.Rest /// public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); /// - public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId); + public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId, ImageFormat.Auto); /// /// Gets the built-in role containing all users in this guild. diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 5421718cb..2f3ac4d90 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -138,7 +138,7 @@ namespace Discord.WebSocket /// public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); /// - public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId); + public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId, ImageFormat.Auto); /// Indicates whether the client has all the members downloaded to the local guild cache. public bool HasAllMembers => MemberCount <= DownloadedMemberCount;// _downloaderPromise.Task.IsCompleted; /// Indicates whether the guild cache is synced to this guild.