From d0b8bcfc6103eb5371fdc1904502feaf8a23e00e Mon Sep 17 00:00:00 2001 From: Essem Date: Mon, 5 Oct 2026 17:41:44 -0500 Subject: [PATCH] emote: Strip variation selectors from Unicode emojis Twemoji's filenames don't line up exactly with the codepoints we get; this should resolve that. --- commands/general/emote.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands/general/emote.js b/commands/general/emote.js index c2d5560b..c1b5d1b5 100644 --- a/commands/general/emote.js +++ b/commands/general/emote.js @@ -22,7 +22,10 @@ class EmoteCommand extends Command { const emojiMatches = emoji.match(/\p{RGI_Emoji}/gv); if (emojiMatches) { for (const emoji of emojiMatches) { - const codePoints = [...emoji].map((v) => v.codePointAt(0)?.toString(16)).join("-"); + const fixed = emoji.includes("\u200d") ? emoji : emoji.replaceAll("\ufe0f", ""); + let codePoints = [...fixed].map((v) => v.codePointAt(0)?.toString(16)).join("-"); + // edge case, the twemoji js parser happens to miss this + if (emoji == "👁️‍🗨️") codePoints = "1f441-200d-1f5e8"; urls.push(`https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets/72x72/${codePoints}.png`); } } -- 2.51.2