streamer-emotes 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # streamer-emotes
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+
2
6
  A library to get Twitch, BTTV, FFZ and 7TV emotes for a given Twitch channel.
3
7
 
4
8
  ## Usage
@@ -15,3 +19,47 @@ const emotes = await getStreamerEmotes("rubius", {
15
19
 
16
20
  console.info(emotes);
17
21
  ```
22
+
23
+ ## Output example
24
+ ```jsonc
25
+ {
26
+ "<provider>": { // Provider prop
27
+ "channel": [ // Channel Emotes
28
+ {
29
+ "animated": true,
30
+ "id": "string",
31
+ "images": [
32
+ {
33
+ "url": "string",
34
+ "version": "string"
35
+ }
36
+ ],
37
+ "name": "string",
38
+ "provider": "string",
39
+ "zeroWidth": true // 7TV zero width emotes only
40
+ }
41
+ ],
42
+ "global": [ // Global Emotes
43
+ {
44
+ "animated": false,
45
+ "id": "string",
46
+ "images": [
47
+ {
48
+ "url": "string",
49
+ "version": "string"
50
+ }
51
+ ],
52
+ "name": "string",
53
+ "provider": "string",
54
+ }
55
+ ]
56
+ }
57
+ }
58
+ ```
59
+
60
+ <!-- Badges -->
61
+ [npm-version-src]: https://img.shields.io/npm/v/streamer-emotes.svg?style=flat
62
+ [npm-version-href]: https://npmjs.com/package/streamer-emotes
63
+
64
+ [npm-downloads-src]: https://img.shields.io/npm/dm/streamer-emotes.svg?style=flat
65
+ [npm-downloads-href]: https://npmjs.com/package/streamer-emotes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/types/index.d.ts
2
- interface StreamerEmotesProps {
2
+ interface StreamerEmotesProps<T> {
3
3
  animated: boolean;
4
4
  id: string;
5
5
  images: {
@@ -7,18 +7,18 @@ interface StreamerEmotesProps {
7
7
  version: string;
8
8
  }[];
9
9
  name: string;
10
- provider: "7tv" | "bttv" | "ffz" | "twitch";
10
+ provider: T;
11
11
  zeroWidth?: boolean;
12
12
  }
13
- interface StreamerEmotesProviderResponse {
14
- channel: StreamerEmotesProps[];
15
- global?: StreamerEmotesProps[];
13
+ interface StreamerEmotesProviderResponse<T> {
14
+ channel: StreamerEmotesProps<T>[];
15
+ global?: StreamerEmotesProps<T>[];
16
16
  }
17
17
  //#endregion
18
18
  //#region src/index.d.ts
19
19
  /**
20
20
  *
21
- * @param channelLogin
21
+ * @param channelLogin Twitch channel login.
22
22
  * @param options.bttv Get emotes from BetterTTV if `true`. Defaults to `false`.
23
23
  * @param options.ffz Get emotes from FrankerFaceZ if `true`. Defaults to `false`.
24
24
  * @param options.sevenTV Get emotes from 7TV if `true`. Defaults to `false`.
@@ -32,10 +32,10 @@ declare const getStreamerEmotes: (channelLogin: string, options: {
32
32
  sevenTV?: boolean | StreamerEmotesProviderOptions;
33
33
  twitch?: boolean | StreamerEmotesProviderOptions;
34
34
  }) => Promise<{
35
- bttv?: StreamerEmotesProviderResponse;
36
- ffz?: StreamerEmotesProviderResponse;
37
- sevenTV?: StreamerEmotesProviderResponse;
38
- twitch?: StreamerEmotesProviderResponse;
35
+ bttv?: StreamerEmotesProviderResponse<"bttv">;
36
+ ffz?: StreamerEmotesProviderResponse<"ffz">;
37
+ sevenTV?: StreamerEmotesProviderResponse<"7tv">;
38
+ twitch?: StreamerEmotesProviderResponse<"twitch">;
39
39
  }>;
40
40
  interface StreamerEmotesProviderOptions {
41
41
  globals: boolean;
package/dist/index.mjs CHANGED
@@ -266,7 +266,7 @@ const getTwitchEmotes = async (channelLogin, options) => {
266
266
  //#region src/index.ts
267
267
  /**
268
268
  *
269
- * @param channelLogin
269
+ * @param channelLogin Twitch channel login.
270
270
  * @param options.bttv Get emotes from BetterTTV if `true`. Defaults to `false`.
271
271
  * @param options.ffz Get emotes from FrankerFaceZ if `true`. Defaults to `false`.
272
272
  * @param options.sevenTV Get emotes from 7TV if `true`. Defaults to `false`.
@@ -279,11 +279,11 @@ const getStreamerEmotes = async (channelLogin, options) => {
279
279
  const { bttv, ffz, sevenTV, twitch } = options;
280
280
  const data = {};
281
281
  let bttvPromise, ffzPromise, sevenTvPromise, twitchPromise;
282
- if (bttv || ffz || sevenTV || twitch) await getTwitchIdByLogin(channelLogin);
283
282
  if (bttv) bttvPromise = getBttvEmotes(channelLogin, { globals: typeof bttv === "boolean" ? true : bttv?.globals ?? true }).catch(() => null);
284
283
  if (ffz) ffzPromise = getFfzEmotes(channelLogin, { globals: typeof ffz === "boolean" ? true : ffz?.globals ?? true }).catch(() => null);
285
284
  if (sevenTV) sevenTvPromise = get7tvEmotes(channelLogin, { globals: typeof sevenTV === "boolean" ? true : sevenTV?.globals ?? true }).catch(() => null);
286
285
  if (twitch) twitchPromise = getTwitchEmotes(channelLogin, { globals: typeof twitch === "boolean" ? true : twitch?.globals ?? true }).catch(() => null);
286
+ await getTwitchIdByLogin(channelLogin);
287
287
  const [bttvEmotes, ffzEmotes, sevenTvEmotes, twitchEmotes] = await Promise.all([
288
288
  bttvPromise,
289
289
  ffzPromise,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "streamer-emotes",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "description": "A library to get Twitch, BTTV, FFZ and 7TV emotes for a given Twitch channel.",
6
6
  "keywords": [
7
7
  "streamer",