| @@ -139,15 +139,17 @@ namespace Discord | |||||
| /// </summary> | /// </summary> | ||||
| /// <param name="guildId">The guild snowflake identifier.</param> | /// <param name="guildId">The guild snowflake identifier.</param> | ||||
| /// <param name="bannerId">The banner image identifier.</param> | /// <param name="bannerId">The banner image identifier.</param> | ||||
| /// <param name="format">The format to return.</param> | |||||
| /// <param name="size">The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048 inclusive.</param> | /// <param name="size">The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048 inclusive.</param> | ||||
| /// <returns> | /// <returns> | ||||
| /// A URL pointing to the guild's banner image. | /// A URL pointing to the guild's banner image. | ||||
| /// </returns> | /// </returns> | ||||
| 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); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| /// Returns an emoji URL. | /// Returns an emoji URL. | ||||
| @@ -102,7 +102,7 @@ namespace Discord.Rest | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); | public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId); | |||||
| public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId, ImageFormat.Auto); | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets the built-in role containing all users in this guild. | /// Gets the built-in role containing all users in this guild. | ||||
| @@ -138,7 +138,7 @@ namespace Discord.WebSocket | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); | public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId); | |||||
| public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId, ImageFormat.Auto); | |||||
| /// <summary> Indicates whether the client has all the members downloaded to the local guild cache. </summary> | /// <summary> Indicates whether the client has all the members downloaded to the local guild cache. </summary> | ||||
| public bool HasAllMembers => MemberCount <= DownloadedMemberCount;// _downloaderPromise.Task.IsCompleted; | public bool HasAllMembers => MemberCount <= DownloadedMemberCount;// _downloaderPromise.Task.IsCompleted; | ||||
| /// <summary> Indicates whether the guild cache is synced to this guild. </summary> | /// <summary> Indicates whether the guild cache is synced to this guild. </summary> | ||||