@mkody/twitch-emoticons 2.4.0 → 2.4.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.
@@ -9,7 +9,10 @@ jobs:
9
9
  - uses: actions/checkout@v2
10
10
  - uses: actions/setup-node@v2
11
11
  with:
12
- node-version: 12
12
+ node-version: 16
13
13
  - run: yarn
14
14
  - run: yarn lint
15
15
  - run: yarn test
16
+ env:
17
+ TWITCH_ID: ${{ secrets.TWITCH_ID }}
18
+ TWITCH_SECRET: ${{ secrets.TWITCH_SECRET }}
package/README.md CHANGED
@@ -54,6 +54,5 @@ fetcher.fetchTwitchEmotes(null).then(() => {
54
54
  - [Changelog](https://github.com/mkody/twitch-emoticons/releases)
55
55
 
56
56
  This library uses the following:
57
- - [Twitch Emotes API](https://twitchemotes.com/apidocs)
58
57
  - [BetterTTV API](https://betterttv.com/)
59
58
  - [FrankerFaceZ API](http://www.frankerfacez.com/developers)
package/docs/index.html CHANGED
@@ -63,7 +63,7 @@
63
63
  <p>You must now use a Twitch user ID instead of the username to fetch user's emotes.<br>
64
64
  You can use <a href="https://s.kdy.ch/twitchid/">this page to quickly grab it</a>.</p>
65
65
  <p><em>FFZ still supports names, but usage of the ID is recommended.</em></p>
66
- <h3>Note about Twitch emotes</h3>
66
+ <h3>About this fork's 2.4.0+</h3>
67
67
  <p>You now need to use the official Twitch API to get emotes. For this you need to provide your client id and client secret.<br>
68
68
  To get a client and secret create a Twitch app <a href="https://dev.twitch.tv/console/apps/create">here</a>, it's free.</p>
69
69
  <p>If you are only using BetterTTV and FrankerFaceZ you don't need to provide anything as they are independent from the Twitch API.</p>
@@ -63,7 +63,7 @@ class EmoteFetcher {
63
63
  * @param {string} clientSecret The client secret for the twitch api.
64
64
  */
65
65
  constructor(clientId, clientSecret) {
66
- if (clientId &amp;&amp; clientSecret) {
66
+ if (clientId !== undefined &amp;&amp; clientSecret !== undefined) {
67
67
  const authProvider = new ClientCredentialsAuthProvider(clientId, clientSecret);
68
68
 
69
69
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkody/twitch-emoticons",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Gets Twitch emotes and BTTV emotes, as well as parsing text to emotes!",
5
5
  "main": "src/index.js",
6
6
  "typings": "typings/index.d.ts",
@@ -17,6 +17,7 @@
17
17
  "author": "MKody <gh@kdy.ch> (André Fernandes)",
18
18
  "contrubutors": [
19
19
  "1Computer",
20
+ "Killusions",
20
21
  "MKody"
21
22
  ],
22
23
  "license": "MIT",
@@ -27,13 +28,13 @@
27
28
  },
28
29
  "devDependencies": {
29
30
  "docdash": "^1.2.0",
30
- "eslint": "^7.27.0",
31
+ "eslint": "^8.0.1",
31
32
  "jsdoc": "^3.6.7"
32
33
  },
33
34
  "scripts": {
34
35
  "docs": "jsdoc --configure .jsdoc.json --verbose --package ''",
35
36
  "test": "node test/index.js",
36
- "lint": "eslint ./src"
37
+ "lint": "eslint ./src ./test"
37
38
  },
38
39
  "repository": {
39
40
  "type": "git",
package/test/index.js CHANGED
@@ -6,16 +6,15 @@ const { EmoteFetcher, EmoteParser } = require('../src/index.js');
6
6
 
7
7
  /**
8
8
  * If environement variables are set, test Twitch fetching.
9
- * If not it has to throws an error.
10
9
  *
11
10
  * Tests:
12
11
  * - Fetch emotes
13
- * - Global Twitch
14
- * - Channel Twitch (twitchplayspokemon)
12
+ * - Twitch Global
13
+ * - Twitch Channel (twitchplayspokemon)
15
14
  * - Link to Kappa
16
15
  * - Parse to Markdown
17
- * - Global Twitch emote (CoolCat)
18
- * - User Twitch emote (tppD)
16
+ * - Twitch Global emote (CoolCat)
17
+ * - Twitch Channel emote (tppD)
19
18
  */
20
19
  if (env.TWITCH_ID !== undefined && env.TWITCH_SECRET !== undefined) {
21
20
  const twitchFetcher = new EmoteFetcher(env.TWITCH_ID, env.TWITCH_SECRET);
@@ -44,30 +43,35 @@ if (env.TWITCH_ID !== undefined && env.TWITCH_SECRET !== undefined) {
44
43
  });
45
44
  } else {
46
45
  console.log('Notice: Twitch client id/secret missing.');
47
- const twitchFetcher = new EmoteFetcher();
46
+ }
48
47
 
49
- try {
50
- assert.throws(() => {
51
- twitchFetcher.fetchTwitchEmotes();
52
- }, new Error('Client id or client secret not provided.'));
53
- } catch (err) {
54
- console.error('Twitch emotes test failed!');
55
- console.error(err);
56
- }
48
+ /*
49
+ * Code should throw if we try to fetch Twitch emotes without a Client ID and Secret
50
+ */
51
+ const twitchFaultyFetcher = new EmoteFetcher();
52
+
53
+ try {
54
+ assert.throws(() => {
55
+ twitchFaultyFetcher.fetchTwitchEmotes();
56
+ }, new Error('Client id or client secret not provided.'));
57
+ console.log('Twitch emotes test (without API keys) was successful.');
58
+ } catch (err) {
59
+ console.error('Twitch emotes test (without API keys) failed!');
60
+ console.error(err);
57
61
  }
58
62
 
59
63
  /**
60
64
  * Tests:
61
65
  * - Fetch emotes
62
- * - Global BTTV
63
- * - Channel BTTV (twitchplayspokemon)
64
- * - FFZ user via user name (sylux98)
65
- * - FFZ user via user ID (shizuka_natsume)
66
+ * - BTTV Global
67
+ * - BTTV Channel (twitchplayspokemon)
68
+ * - FFZ via user name (sylux98)
69
+ * - FFZ via user ID (shizuka_natsume)
66
70
  *
67
71
  * - Parse to Markdown
68
- * - Global BTTV emote (SourPls)
69
- * - Channel BTTV emote (tppUrn)
70
- * - Shared BTTV emote (MODS)
72
+ * - BTTV Global emote (SourPls)
73
+ * - BTTV Channel emote (tppUrn)
74
+ * - BTTV Shared emote (MODS)
71
75
  * - FFZ emote from user name (AWOOO)
72
76
  * - FFZ emote from user ID (SanaeSip)
73
77
  */
@@ -31,6 +31,8 @@ declare module '@mkody/twitch-emoticons' {
31
31
  }
32
32
 
33
33
  export class EmoteFetcher {
34
+ public constructor(clientId?: string, clientSecret?: string);
35
+
34
36
  public emotes: Collection<string, Emote>;
35
37
  public channels: Collection<string, Channel>;
36
38