blob: 7f736888709f2ca9cfb282568d123cc48855f9e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
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`;
}
});
}
|