Skip to content

Commit

Permalink
fix: broken emojis (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzDerock committed Mar 18, 2023
1 parent 401a2c4 commit 482c83c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ export function parseDiscordEmoji(emoji: Emoji | APIMessageComponentEmoji) {
return `https://cdn.discordapp.com/emojis/${emoji.id}.${emoji.animated ? 'gif' : 'png'}`;
}

const codepoints = twemoji.convert.toCodePoint(emoji.name!);
return `https://twemoji.maxcdn.com/v/latest/svg/${codepoints}.svg`;
const codepoints = twemoji.convert.toCodePoint(
emoji.name!.indexOf(String.fromCharCode(0x200D)) < 0
? emoji.name!.replace(/\uFE0F/g, '')
: emoji.name!
).toLowerCase();

return `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${codepoints}.svg`;
}

export async function downloadImageToDataURL(url: string): Promise<string | null> {
Expand Down

0 comments on commit 482c83c

Please # to comment.