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) { badges["moderator/1"] = room["moderator_badge"]; } if ("vip_badge" in room) { 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"]; } } }); }