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`; } }); } function get7TVChannelEmotes(twitchId, emotes) { return fetch(`https://7tv.io/v3/users/twitch/${twitchId}`) .then((r) => r.json()) .then((json) => { if ("error" in json) { addSystemMessage(`${json["error"]} (7TV)`); return; } for (const e of json["emote_set"]["emotes"]) { emotes[e["name"]] = `https://cdn.7tv.app/emote/${e["id"]}/1x.webp`; } }); } function get7TVGlobalEmotes(emotes) { return fetch(`https://7tv.io/v3/emote-sets/global`) .then((r) => r.json()) .then((json) => { for (const e of json["emotes"]) { emotes[e["name"]] = `https://cdn.7tv.app/emote/${e["id"]}/1x.webp`; } }); } function getFFZChannelEmotes(twitchId, emotes) { return fetch(`https://api.frankerfacez.com/v1/room/id/${twitchId}`) .then((r) => r.json()) .then((json) => { if ("error" in json) { addSystemMessage(`${json["error"]} (FFZ)`); return; } const room = json["room"]; if ("moderator_badge" in room && room["moderator_badge"] !== null) { badges["moderator/1"] = room["moderator_badge"]; } if ("vip_badge" in room && room["vip_badge"] !== null) { badges["vip/1"] = room["vip_badge"]["1"]; } if (room["set"] in json["sets"]) { for (const e of json["sets"][room["set"]]["emoticons"]) { emotes[e["name"]] = e["urls"]["1"]; } } }); } function getFFZGlobalEmotes(emotes) { return fetch(`https://api.frankerfacez.com/v1/set/global`) .then((r) => r.json()) .then((json) => { for (const id of json["default_sets"]) { for (const e of json["sets"][id]["emoticons"]) { emotes[e["name"]] = e["urls"]["1"]; } } }); } function getTinyemotesChannelEmotes(instance, twitchId, emotes) { fetch(`${instance}/users.php?alias_id=${twitchId}`, { headers: { 'Accept': 'application/json' } }) .then((r) => r.json()) .then((json) => { if (json.status_code != 200) { addSystemMessage(`${json.message} (${instance})`); return; } const data = json["data"]; const set_id = data["active_emote_set_id"]; const emote_set = data["emote_sets"].find((x) => x["id"] == set_id); if (emote_set) { for (const e of emote_set["emotes"]) { emotes[e["code"]] = `${instance}/static/userdata/emotes/${e["id"]}/1x.webp`; } } }); } function getTinyemotesGlobalEmotes(instance, emotes) { fetch(`${instance}/emotesets.php?id=global`, { headers: { 'Accept': 'application/json' } }) .then((r) => r.json()) .then((json) => { if (json.status_code != 200) { addSystemMessage(`${json.message} (${instance})`); return; } for (const e of json["data"]["emotes"]) { emotes[e["code"]] = `${instance}/static/userdata/emotes/${e["id"]}/1x.webp`; } }); }