Skip to content

Commit

Permalink
StickFormat gif and animated guild icon (#2986)
Browse files Browse the repository at this point in the history
* Added support for animated server icon

* Added gif in StickFormatType

https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types
  • Loading branch information
ForceFK authored Aug 29, 2024
1 parent 5ca5aa5 commit 2aaa0fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/Discord.Net.Core/CDN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ public static string GetDefaultUserAvatarUrl(ulong userId)
/// <param name="guildId">The guild snowflake 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="format">The format to return.</param>
/// <returns>
/// A URL pointing to the guild's icon.
/// </returns>
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}";
}
/// <summary>
/// Returns a guild role's icon URL.
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion src/Discord.Net.Core/Entities/Messages/StickerFormatType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public enum StickerFormatType
/// <summary>
/// The sticker format type is lottie.
/// </summary>
Lottie = 3
Lottie = 3,
/// <summary>
/// The sticker format type is gif.
/// </summary>
Gif = 4
}
}

0 comments on commit 2aaa0fd

Please sign in to comment.