mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
fix: create emoji BINARY_TYPE_INVALID_DATA_URI
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
DiscordEmoji,
|
||||
WithReason
|
||||
} from '@discordeno/types'
|
||||
import { urlToBase64 } from '@discordeno/utils'
|
||||
import type { RestManager } from '../../restManager.js'
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,10 @@ export async function createEmoji (
|
||||
guildId: BigString,
|
||||
options: CreateGuildEmoji
|
||||
): Promise<Camelize<DiscordEmoji>> {
|
||||
if (options.image && !options.image.startsWith('data:image/')) {
|
||||
options.image = await urlToBase64(options.image)
|
||||
}
|
||||
|
||||
const result = await rest.runMethod<DiscordEmoji>(
|
||||
'POST',
|
||||
routes.GUILD_EMOJIS(guildId),
|
||||
|
||||
Reference in New Issue
Block a user