streamer-emotes 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +15 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -190,6 +190,7 @@ const getFfzEmotes = async (channelLogin, options) => {
|
|
|
190
190
|
const getTwitchEmotes = async (channelLogin, options) => {
|
|
191
191
|
channelLogin = channelLogin.toLowerCase();
|
|
192
192
|
const { globals = true } = options ?? {};
|
|
193
|
+
const channelId = await getTwitchIdByLogin(channelLogin);
|
|
193
194
|
const emotesFields = [
|
|
194
195
|
"id",
|
|
195
196
|
"token",
|
|
@@ -211,9 +212,18 @@ const getTwitchEmotes = async (channelLogin, options) => {
|
|
|
211
212
|
} },
|
|
212
213
|
fields: [{ emotes: emotesFields }]
|
|
213
214
|
};
|
|
215
|
+
const localEmotesQuery = {
|
|
216
|
+
operation: "channel",
|
|
217
|
+
variables: { id: {
|
|
218
|
+
value: channelId,
|
|
219
|
+
type: "ID!"
|
|
220
|
+
} },
|
|
221
|
+
fields: [{ localEmoteSets: [{ emotes: emotesFields }] }]
|
|
222
|
+
};
|
|
214
223
|
const toQuery = [];
|
|
215
224
|
if (globals) toQuery.push(globalQuery);
|
|
216
225
|
toQuery.push(channelQuery);
|
|
226
|
+
toQuery.push(localEmotesQuery);
|
|
217
227
|
const { data } = await $fetch(providersURL.twitch, {
|
|
218
228
|
method: "POST",
|
|
219
229
|
headers: {
|
|
@@ -229,15 +239,15 @@ const getTwitchEmotes = async (channelLogin, options) => {
|
|
|
229
239
|
id: emote.id,
|
|
230
240
|
images: [
|
|
231
241
|
{
|
|
232
|
-
url: `https://static-cdn.jtvnw.net/emoticons/
|
|
242
|
+
url: `https://static-cdn.jtvnw.net/emoticons/v2/${emote.id}/default/dark/1.0`,
|
|
233
243
|
version: "1.0"
|
|
234
244
|
},
|
|
235
245
|
{
|
|
236
|
-
url: `https://static-cdn.jtvnw.net/emoticons/
|
|
246
|
+
url: `https://static-cdn.jtvnw.net/emoticons/v2/${emote.id}/default/dark/2.0`,
|
|
237
247
|
version: "2.0"
|
|
238
248
|
},
|
|
239
249
|
{
|
|
240
|
-
url: `https://static-cdn.jtvnw.net/emoticons/
|
|
250
|
+
url: `https://static-cdn.jtvnw.net/emoticons/v2/${emote.id}/default/dark/3.0`,
|
|
241
251
|
version: "3.0"
|
|
242
252
|
}
|
|
243
253
|
],
|
|
@@ -246,7 +256,7 @@ const getTwitchEmotes = async (channelLogin, options) => {
|
|
|
246
256
|
}));
|
|
247
257
|
};
|
|
248
258
|
return {
|
|
249
|
-
channel: normalizeData(data?.subscriptionProduct?.emotes),
|
|
259
|
+
channel: [...normalizeData(data?.channel.localEmoteSets?.[0]?.emotes), ...normalizeData(data?.subscriptionProduct?.emotes)],
|
|
250
260
|
...globals && { global: normalizeData(data?.emoteSet?.emotes) }
|
|
251
261
|
};
|
|
252
262
|
};
|
|
@@ -267,7 +277,7 @@ const getStreamerEmotes = async (channelLogin, options) => {
|
|
|
267
277
|
const { bttv, ffz, sevenTV, twitch } = options;
|
|
268
278
|
const data = {};
|
|
269
279
|
let bttvPromise, ffzPromise, sevenTvPromise, twitchPromise;
|
|
270
|
-
if (bttv || ffz || sevenTV) await getTwitchIdByLogin(channelLogin);
|
|
280
|
+
if (bttv || ffz || sevenTV || twitch) await getTwitchIdByLogin(channelLogin);
|
|
271
281
|
if (bttv) bttvPromise = getBttvEmotes(channelLogin, { globals: typeof bttv === "boolean" ? true : bttv?.globals }).catch(() => null);
|
|
272
282
|
if (ffz) ffzPromise = getFfzEmotes(channelLogin, { globals: typeof ffz === "boolean" ? true : ffz?.globals }).catch(() => null);
|
|
273
283
|
if (sevenTV) sevenTvPromise = get7tvEmotes(channelLogin, { globals: typeof sevenTV === "boolean" ? true : sevenTV?.globals }).catch(() => null);
|