Skip to content

Commit

Permalink
Support apng & webm
Browse files Browse the repository at this point in the history
  • Loading branch information
DEVTomatoCake authored and MaddyUnderStars committed Jul 17, 2024
1 parent 0096938 commit 2f679fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api/routes/guilds/#guild_id/emojis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,18 @@ router.post(
const user = await User.findOneOrFail({ where: { id: req.user_id } });
body.image = (await handleFile(`/emojis/${id}`, body.image)) as string;

const mimeType = body.image.split(":")[1].split(";")[0];
const emoji = await Emoji.create({
id: id,
guild_id: guild_id,
...body,
require_colons: body.require_colons ?? undefined, // schema allows nulls, db does not
user: user,
managed: false,
animated: body.image.split(":")[1].split(";")[0] == "image/gif",
animated:
mimeType == "image/gif" ||
mimeType == "image/apng" ||
mimeType == "video/webm",
available: true,
roles: [],
}).save();
Expand Down

0 comments on commit 2f679fd

Please sign in to comment.