summaryrefslogtreecommitdiff
path: root/scripts/emotes.js
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-10-26 00:03:54 +0500
committerilotterytea <iltsu@alright.party>2025-10-26 00:03:54 +0500
commit73c9099e90e1a279f65567cfe751afdc11adcbb2 (patch)
treee61c7f0b9aa8219115e34355a0f184cc8def08bf /scripts/emotes.js
parentd6eb4a393b602358e67a4348289bae5592e5520b (diff)
feat: betterttv emotes
Diffstat (limited to 'scripts/emotes.js')
-rw-r--r--scripts/emotes.js24
1 files changed, 24 insertions, 0 deletions
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