From 73c9099e90e1a279f65567cfe751afdc11adcbb2 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 26 Oct 2025 00:03:54 +0500 Subject: feat: betterttv emotes --- scripts/emotes.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/emotes.js (limited to 'scripts/emotes.js') diff --git a/scripts/emotes.js b/scripts/emotes.js new file mode 100644 index 0000000..96bc103 --- /dev/null +++ b/scripts/emotes.js @@ -0,0 +1,24 @@ +function getBetterTTVChannelEmotes(twitchId, emotes) { + return fetch(`https://api.betterttv.net/3/cached/users/twitch/${twitchId}`) + .then((r) => r.json()) + .then((json) => { + if ("message" in json) { + addSystemMessage(`${json["message"]} (BetterTTV)`); + return; + } + + for (const e of [...json["channelEmotes"], ...json["sharedEmotes"]]) { + emotes[e["code"]] = `https://cdn.betterttv.net/emote/${e["id"]}/1x.webp`; + } + }); +} + +function getBetterTTVGlobalEmotes(emotes) { + return fetch(`https://api.betterttv.net/3/cached/emotes/global`) + .then((r) => r.json()) + .then((json) => { + for (const e of json) { + emotes[e["code"]] = `https://cdn.betterttv.net/emote/${e["id"]}/1x.webp`; + } + }); +} \ No newline at end of file -- cgit v1.2.3