Update create_emoji.ts

This commit is contained in:
ITOH
2021-04-23 23:31:48 +02:00
parent cc2af6f900
commit 160a957323
+2 -4
View File
@@ -3,7 +3,7 @@ import { CreateGuildEmoji } from "../../types/emojis/create_guild_emoji.ts";
import { Emoji } from "../../types/emojis/emoji.ts"; import { Emoji } from "../../types/emojis/emoji.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts"; import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { snakeKeysToCamelCase, urlToBase64 } from "../../util/utils.ts"; import { urlToBase64 } from "../../util/utils.ts";
/** Create an emoji in the server. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */ /** Create an emoji in the server. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */
export async function createEmoji( export async function createEmoji(
@@ -18,11 +18,9 @@ export async function createEmoji(
image = await urlToBase64(image); image = await urlToBase64(image);
} }
const result = await rest.runMethod("post", endpoints.GUILD_EMOJIS(guildId), { return await rest.runMethod<Emoji>("post", endpoints.GUILD_EMOJIS(guildId), {
...options, ...options,
name, name,
image, image,
}); });
return snakeKeysToCamelCase<Emoji>(result);
} }