diff --git a/src/main/java/net/dv8tion/jda/api/entities/Guild.java b/src/main/java/net/dv8tion/jda/api/entities/Guild.java index 0183a3d8e1..f61853dc79 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -4582,7 +4582,7 @@ default RoleAction createCopyOfRole(@Nonnull Role role) * @param description * The sticker description (2-100 characters, or empty) * @param file - * The sticker file containing the asset (png/apng/lottie) with valid file extension (png or json) + * The sticker file containing the asset (png/apng/gif/lottie) with valid file extension (png, gif, or json) * @param tags * The tags to use for auto-suggestions (Up to 200 characters in total) * @@ -4592,7 +4592,7 @@ default RoleAction createCopyOfRole(@Nonnull Role role) * * @@ -4618,7 +4618,7 @@ default RoleAction createCopyOfRole(@Nonnull Role role) * @param description * The sticker description (2-100 characters, or empty) * @param file - * The sticker file containing the asset (png/apng/lottie) with valid file extension (png or json) + * The sticker file containing the asset (png/apng/gif/lottie) with valid file extension (png, gif, or json) * @param tag * The sticker tag used for suggestions (emoji or tag words) * @param tags @@ -4630,7 +4630,7 @@ default RoleAction createCopyOfRole(@Nonnull Role role) * * diff --git a/src/main/java/net/dv8tion/jda/api/entities/sticker/Sticker.java b/src/main/java/net/dv8tion/jda/api/entities/sticker/Sticker.java index 317fbba6ca..092f215178 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/sticker/Sticker.java +++ b/src/main/java/net/dv8tion/jda/api/entities/sticker/Sticker.java @@ -145,6 +145,10 @@ enum StickerFormat * @see Lottie website */ LOTTIE(3, "json"), + /** + * The GIF format. + */ + GIF(4, "gif"), /** * Represents any unknown or unsupported format types. */ diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 6c78abff16..3c565a5376 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -1785,7 +1785,7 @@ public AuditableRestAction createSticker(@Nonnull String name, @No // Extract file extension and map to media type int index = file.getName().lastIndexOf('.'); - Checks.check(index > -1, "Filename for sticker is missing file extension. Provided: '" + file.getName() + "'. Must be PNG or JSON."); + Checks.check(index > -1, "Filename for sticker is missing file extension. Provided: '" + file.getName() + "'. Must be PNG, GIF, or JSON."); // Convert file extension to media-type String extension = file.getName().substring(index + 1).toLowerCase(Locale.ROOT); @@ -1796,11 +1796,14 @@ public AuditableRestAction createSticker(@Nonnull String name, @No case "png": mediaType = Requester.MEDIA_TYPE_PNG; break; + case "gif": + mediaType = Requester.MEDIA_TYPE_GIF; + break; case "json": mediaType = Requester.MEDIA_TYPE_JSON; break; default: - throw new IllegalArgumentException("Unsupported file extension: '." + extension + "', must be PNG or JSON."); + throw new IllegalArgumentException("Unsupported file extension: '." + extension + "', must be PNG, GIF, or JSON."); } // Add sticker metadata as form parts (because payload_json is broken) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java index 9ff712caa3..f13edaf641 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java @@ -55,6 +55,7 @@ public class Requester public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8"); public static final MediaType MEDIA_TYPE_OCTET = MediaType.parse("application/octet-stream; charset=utf-8"); public static final MediaType MEDIA_TYPE_PNG = MediaType.parse("image/png"); + public static final MediaType MEDIA_TYPE_GIF = MediaType.parse("image/gif"); protected final JDAImpl api; protected final AuthorizationConfig authConfig;