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
This commit is contained in:
ForceFK
2024-08-29 05:10:33 -03:00
committed by GitHub
parent 5ca5aa51c4
commit 2aaa0fd2ff
2 changed files with 13 additions and 3 deletions

View File

@@ -111,11 +111,17 @@ namespace Discord
/// <param name="guildId">The guild snowflake identifier.</param> /// <param name="guildId">The guild snowflake identifier.</param>
/// <param name="iconId">The icon identifier.</param> /// <param name="iconId">The icon identifier.</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.</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.</param>
/// <param name="format">The format to return.</param>
/// <returns> /// <returns>
/// A URL pointing to the guild's icon. /// A URL pointing to the guild's icon.
/// </returns> /// </returns>
public static string GetGuildIconUrl(ulong guildId, string iconId, ushort size = 2048) public static string GetGuildIconUrl(ulong guildId, string iconId, ushort size = 2048, ImageFormat format = ImageFormat.Auto)
=> iconId != null ? $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.jpg?size={size}" : null; {
if (iconId == null)
return null;
string extension = FormatToExtension(format, iconId);
return $"{DiscordConfig.CDNUrl}icons/{guildId}/{iconId}.{extension}?size={size}";
}
/// <summary> /// <summary>
/// Returns a guild role's icon URL. /// Returns a guild role's icon URL.
/// </summary> /// </summary>

View File

@@ -20,6 +20,10 @@ namespace Discord
/// <summary> /// <summary>
/// The sticker format type is lottie. /// The sticker format type is lottie.
/// </summary> /// </summary>
Lottie = 3 Lottie = 3,
/// <summary>
/// The sticker format type is gif.
/// </summary>
Gif = 4
} }
} }