From 2aaa0fd2ffb07ed8cc3e1bec03de93e0f87f6412 Mon Sep 17 00:00:00 2001 From: ForceFK <68686847+ForceFK@users.noreply.github.com> Date: Thu, 29 Aug 2024 05:10:33 -0300 Subject: [PATCH] StickFormat gif and animated guild icon (#2986) * Added support for animated server icon * Added gif in StickFormatType https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types --- src/Discord.Net.Core/CDN.cs | 10 ++++++++-- .../Entities/Messages/StickerFormatType.cs | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net.Core/CDN.cs b/src/Discord.Net.Core/CDN.cs index 4349d19b..266a16de 100644 --- a/src/Discord.Net.Core/CDN.cs +++ b/src/Discord.Net.Core/CDN.cs @@ -111,11 +111,17 @@ namespace Discord /// The guild snowflake identifier. /// The icon identifier. /// The size of the image to return in horizontal pixels. This can be any power of two between 16 and 2048. + /// The format to return. /// /// A URL pointing to the guild's icon. /// - public static string GetGuildIconUrl(ulong guildId, string iconId, ushort size = 2048) - => iconId != null ? $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.jpg?size={size}" : null; + public static string GetGuildIconUrl(ulong guildId, string iconId, ushort size = 2048, ImageFormat format = ImageFormat.Auto) + { + if (iconId == null) + return null; + string extension = FormatToExtension(format, iconId); + return $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.{extension}?size={size}"; + } /// /// Returns a guild role's icon URL. /// diff --git a/src/Discord.Net.Core/Entities/Messages/StickerFormatType.cs b/src/Discord.Net.Core/Entities/Messages/StickerFormatType.cs index 82e6b15a..c0bc219a 100644 --- a/src/Discord.Net.Core/Entities/Messages/StickerFormatType.cs +++ b/src/Discord.Net.Core/Entities/Messages/StickerFormatType.cs @@ -20,6 +20,10 @@ namespace Discord /// /// The sticker format type is lottie. /// - Lottie = 3 + Lottie = 3, + /// + /// The sticker format type is gif. + /// + Gif = 4 } }