diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/emotes.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/emotes.js b/scripts/emotes.js index 84f9901..f99bb44 100644 --- a/scripts/emotes.js +++ b/scripts/emotes.js @@ -46,4 +46,43 @@ function get7TVGlobalEmotes(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"]; + } + } + }); }
\ No newline at end of file |
