streamer-emotes 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. package/dist/index.mjs +12 -11
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -48,14 +48,14 @@ const get7tvEmotes = async (channelLogin, options) => {
48
48
  const channelDataPromise = $fetch(`/users/twitch/${channelId}`, {
49
49
  baseURL: providersURL.sevenTV,
50
50
  method: "GET"
51
- });
51
+ }).catch(() => null);
52
52
  let globalDataPromise;
53
53
  if (globals) globalDataPromise = $fetch("/emote-sets/global", {
54
54
  baseURL: providersURL.sevenTV,
55
55
  method: "GET"
56
56
  });
57
57
  const [channelData, globalData] = await Promise.all([channelDataPromise, globalDataPromise]);
58
- channel.push(...channelData.emote_set.emotes);
58
+ if (channelData) channel.push(...channelData.emote_set.emotes);
59
59
  if (globalData) global.push(...globalData.emotes);
60
60
  const normalizeData = (data) => {
61
61
  if (!data?.length) return [];
@@ -95,14 +95,14 @@ const getBttvEmotes = async (channelLogin, options) => {
95
95
  const channelDataPromise = $fetch(`/cached/users/twitch/${channelId}`, {
96
96
  baseURL: providersURL.bttv,
97
97
  method: "GET"
98
- });
98
+ }).catch(() => null);
99
99
  let globalDataPromise;
100
100
  if (globals) globalDataPromise = $fetch("/cached/emotes/global", {
101
101
  baseURL: providersURL.bttv,
102
102
  method: "GET"
103
103
  });
104
104
  const [channelData, globalData] = await Promise.all([channelDataPromise, globalDataPromise]);
105
- channel.push(...channelData.channelEmotes, ...channelData.sharedEmotes);
105
+ if (channelData) channel.push(...channelData.channelEmotes, ...channelData.sharedEmotes);
106
106
  if (globalData) global.push(...globalData);
107
107
  const normalizeData = (data) => {
108
108
  if (!data?.length) return [];
@@ -149,14 +149,14 @@ const getFfzEmotes = async (channelLogin, options) => {
149
149
  const channelDataPromise = $fetch(`/room/id/${channelId}`, {
150
150
  baseURL: providersURL.ffz,
151
151
  method: "GET"
152
- });
152
+ }).catch(() => null);
153
153
  let globalDataPromise;
154
154
  if (globals) globalDataPromise = $fetch("/set/global", {
155
155
  baseURL: providersURL.ffz,
156
156
  method: "GET"
157
157
  });
158
158
  const [channelData, globalData] = await Promise.all([channelDataPromise, globalDataPromise]);
159
- channel.push(...channelData.sets[channelData.room.set].emoticons);
159
+ if (channelData) channel.push(...channelData.sets[channelData.room.set].emoticons);
160
160
  if (globalData) global.push(...globalData.default_sets.flatMap((setId) => globalData.sets[setId].emoticons));
161
161
  const normalizeData = (data) => {
162
162
  if (!data?.length) return [];
@@ -214,7 +214,8 @@ const getTwitchEmotes = async (channelLogin, options) => {
214
214
  };
215
215
  const localEmotesQuery = {
216
216
  operation: "channel",
217
- variables: { id: {
217
+ variables: { channelId: {
218
+ name: "id",
218
219
  value: channelId,
219
220
  type: "ID!"
220
221
  } },
@@ -278,10 +279,10 @@ const getStreamerEmotes = async (channelLogin, options) => {
278
279
  const data = {};
279
280
  let bttvPromise, ffzPromise, sevenTvPromise, twitchPromise;
280
281
  if (bttv || ffz || sevenTV || twitch) await getTwitchIdByLogin(channelLogin);
281
- if (bttv) bttvPromise = getBttvEmotes(channelLogin, { globals: typeof bttv === "boolean" ? true : bttv?.globals }).catch(() => null);
282
- if (ffz) ffzPromise = getFfzEmotes(channelLogin, { globals: typeof ffz === "boolean" ? true : ffz?.globals }).catch(() => null);
283
- if (sevenTV) sevenTvPromise = get7tvEmotes(channelLogin, { globals: typeof sevenTV === "boolean" ? true : sevenTV?.globals }).catch(() => null);
284
- if (twitch) twitchPromise = getTwitchEmotes(channelLogin, { globals: typeof twitch === "boolean" ? true : twitch?.globals }).catch(() => null);
282
+ if (bttv) bttvPromise = getBttvEmotes(channelLogin, { globals: typeof bttv === "boolean" ? true : bttv?.globals ?? true }).catch(() => null);
283
+ if (ffz) ffzPromise = getFfzEmotes(channelLogin, { globals: typeof ffz === "boolean" ? true : ffz?.globals ?? true }).catch(() => null);
284
+ if (sevenTV) sevenTvPromise = get7tvEmotes(channelLogin, { globals: typeof sevenTV === "boolean" ? true : sevenTV?.globals ?? true }).catch(() => null);
285
+ if (twitch) twitchPromise = getTwitchEmotes(channelLogin, { globals: typeof twitch === "boolean" ? true : twitch?.globals ?? true }).catch(() => null);
285
286
  const [bttvEmotes, ffzEmotes, sevenTvEmotes, twitchEmotes] = await Promise.all([
286
287
  bttvPromise,
287
288
  ffzPromise,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "streamer-emotes",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "description": "A library to get Twitch, BTTV, FFZ and 7TV emotes for a given Twitch channel.",
6
6
  "keywords": [
7
7
  "streamer",