Skip to content

Instantly share code, notes, and snippets.

@qwertykid
Last active June 17, 2023 16:26
Show Gist options
  • Save qwertykid/356248a65a324ef8842f23fed0e38fee to your computer and use it in GitHub Desktop.
Save qwertykid/356248a65a324ef8842f23fed0e38fee to your computer and use it in GitHub Desktop.
{js:
var emoji = "{args:0}"
{ignore:
let o = 2
let l = (emoji.length / 2) - 1
if (emoji.startsWith("<:") && emoji.endsWith(">")) {
var url = `https://cdn.discordapp.com/emojis/${emoji.split(":")[2].substr(0,19)}.png`
} else {
let codePoint = emoji.codePointAt(0);
let unicode =
codePoint.toString(16)
let e = unicode.toLowerCase();
while (l > 0) {
let codePoint = emoji.codePointAt(o);
let unicode =
codePoint.toString(16)
e = e + '-' + unicode.toLowerCase();
o = o + 2
l = l - 1
}
url = `https://github.com/jdecked/twemoji/raw/main/assets/72x72/${e}.png`;
}
fetch(url).then(function (res) {return(ImageScript.decode(res.arrayBuffer()).then(res => res.invert().encode()))})
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment