@mkody/twitch-emoticons 2.4.1 → 2.5.0

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,6 +1,6 @@
1
1
  # twitch-emoticons
2
2
 
3
- Get a Twitch channel's Twitch emotes, BTTV emotes, and FFZ emotes!
3
+ Gets Twitch, BTTV and FFZ emotes as well as parsing text to emotes!
4
4
 
5
5
  ### About this fork's 2.3.0+
6
6
  You must now use a Twitch user ID instead of the username to fetch user's emotes.
@@ -1179,7 +1179,7 @@ Will give the emote's name.</p>
1179
1179
  <br class="clear">
1180
1180
 
1181
1181
  <footer>
1182
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1182
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1183
1183
  </footer>
1184
1184
 
1185
1185
  <script>prettyPrint();</script>
package/docs/Channel.html CHANGED
@@ -688,7 +688,7 @@ For the global channel, the name will be null.</p>
688
688
  <br class="clear">
689
689
 
690
690
  <footer>
691
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
691
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
692
692
  </footer>
693
693
 
694
694
  <script>prettyPrint();</script>
@@ -779,7 +779,7 @@ Same as <code>Array#map</code>.</p>
779
779
  <br class="clear">
780
780
 
781
781
  <footer>
782
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
782
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
783
783
  </footer>
784
784
 
785
785
  <script>prettyPrint();</script>
package/docs/Emote.html CHANGED
@@ -756,7 +756,7 @@ Will give the emote's name.</p>
756
756
  <br class="clear">
757
757
 
758
758
  <footer>
759
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
759
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
760
760
  </footer>
761
761
 
762
762
  <script>prettyPrint();</script>
@@ -2063,7 +2063,7 @@ Use <code>null</code> for the global emotes channel.</p>
2063
2063
  <br class="clear">
2064
2064
 
2065
2065
  <footer>
2066
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2066
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2067
2067
  </footer>
2068
2068
 
2069
2069
  <script>prettyPrint();</script>
@@ -780,7 +780,7 @@ Must be a global regex, with one capture group for the emote code.</p></td>
780
780
  <br class="clear">
781
781
 
782
782
  <footer>
783
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
783
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
784
784
  </footer>
785
785
 
786
786
  <script>prettyPrint();</script>
@@ -1251,7 +1251,7 @@ Will give the emote's name.</p>
1251
1251
  <br class="clear">
1252
1252
 
1253
1253
  <footer>
1254
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1254
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1255
1255
  </footer>
1256
1256
 
1257
1257
  <script>prettyPrint();</script>
@@ -1177,7 +1177,7 @@ Will give the emote's name.</p>
1177
1177
  <br class="clear">
1178
1178
 
1179
1179
  <footer>
1180
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1180
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1181
1181
  </footer>
1182
1182
 
1183
1183
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -103,7 +103,6 @@ fetcher.fetchTwitchEmotes(null).then(() => {
103
103
  </ul>
104
104
  <p>This library uses the following:</p>
105
105
  <ul>
106
- <li><a href="https://twitchemotes.com/apidocs">Twitch Emotes API</a></li>
107
106
  <li><a href="https://betterttv.com/">BetterTTV API</a></li>
108
107
  <li><a href="http://www.frankerfacez.com/developers">FrankerFaceZ API</a></li>
109
108
  </ul></article>
@@ -121,7 +120,7 @@ fetcher.fetchTwitchEmotes(null).then(() => {
121
120
  <br class="clear">
122
121
 
123
122
  <footer>
124
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
123
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
125
124
  </footer>
126
125
 
127
126
  <script>prettyPrint();</script>
@@ -110,7 +110,7 @@ module.exports = BTTVEmote;
110
110
  <br class="clear">
111
111
 
112
112
  <footer>
113
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
113
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
114
114
  </footer>
115
115
 
116
116
  <script>prettyPrint();</script>
@@ -103,7 +103,7 @@ module.exports = Channel;
103
103
  <br class="clear">
104
104
 
105
105
  <footer>
106
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
106
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
107
107
  </footer>
108
108
 
109
109
  <script>prettyPrint();</script>
@@ -121,7 +121,7 @@ module.exports = Emote;
121
121
  <br class="clear">
122
122
 
123
123
  <footer>
124
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
124
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
125
125
  </footer>
126
126
 
127
127
  <script>prettyPrint();</script>
@@ -283,7 +283,7 @@ module.exports = EmoteFetcher;
283
283
  <br class="clear">
284
284
 
285
285
  <footer>
286
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
286
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
287
287
  </footer>
288
288
 
289
289
  <script>prettyPrint();</script>
@@ -136,7 +136,7 @@ module.exports = EmoteParser;
136
136
  <br class="clear">
137
137
 
138
138
  <footer>
139
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
139
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
140
140
  </footer>
141
141
 
142
142
  <script>prettyPrint();</script>
@@ -117,7 +117,7 @@ module.exports = FFZEmote;
117
117
  <br class="clear">
118
118
 
119
119
  <footer>
120
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
120
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
121
121
  </footer>
122
122
 
123
123
  <script>prettyPrint();</script>
@@ -108,7 +108,7 @@ module.exports = TwitchEmote;
108
108
  <br class="clear">
109
109
 
110
110
  <footer>
111
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
111
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
112
112
  </footer>
113
113
 
114
114
  <script>prettyPrint();</script>
@@ -134,7 +134,7 @@ module.exports = Collection;
134
134
  <br class="clear">
135
135
 
136
136
  <footer>
137
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
137
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
138
138
  </footer>
139
139
 
140
140
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@mkody/twitch-emoticons",
3
- "version": "2.4.1",
4
- "description": "Gets Twitch emotes and BTTV emotes, as well as parsing text to emotes!",
3
+ "version": "2.5.0",
4
+ "description": "Gets Twitch, BTTV and FFZ emotes as well as parsing text to emotes!",
5
5
  "main": "src/index.js",
6
6
  "typings": "typings/index.d.ts",
7
7
  "keywords": [
8
+ "better",
9
+ "bttv",
10
+ "emoji",
8
11
  "emote",
9
12
  "emoticon",
10
- "emoji",
11
- "bttv",
12
- "better",
13
- "twitch",
13
+ "ffz",
14
+ "parse",
14
15
  "tv",
15
- "parse"
16
+ "twitch"
16
17
  ],
17
18
  "author": "MKody <gh@kdy.ch> (André Fernandes)",
18
19
  "contrubutors": [
@@ -22,14 +23,14 @@
22
23
  ],
23
24
  "license": "MIT",
24
25
  "dependencies": {
25
- "@twurple/api": "^5.0.5",
26
- "@twurple/auth": "^5.0.5",
27
- "got": "^11.8.2"
26
+ "@twurple/api": "^5.1.7",
27
+ "@twurple/auth": "^5.1.7",
28
+ "got": "^11.8.5"
28
29
  },
29
30
  "devDependencies": {
30
31
  "docdash": "^1.2.0",
31
- "eslint": "^8.0.1",
32
- "jsdoc": "^3.6.7"
32
+ "eslint": "^8.20.0",
33
+ "jsdoc": "^3.6.11"
33
34
  },
34
35
  "scripts": {
35
36
  "docs": "jsdoc --configure .jsdoc.json --verbose --package ''",
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  Twitch: {
3
- CDN: (id, size) => `https://static-cdn.jtvnw.net/emoticons/v1/${id}/${size + 1}.0`
3
+ CDN: (id, size) => `https://static-cdn.jtvnw.net/emoticons/v2/${id}/default/dark/${size + 1}.0`
4
4
  },
5
5
  BTTV: {
6
6
  Global: 'https://api.betterttv.net/3/cached/emotes/global',
package/test/index.js CHANGED
@@ -5,7 +5,7 @@ const { env } = require('process');
5
5
  const { EmoteFetcher, EmoteParser } = require('../src/index.js');
6
6
 
7
7
  /**
8
- * If environement variables are set, test Twitch fetching.
8
+ * If environement variables are set, test Twitch fetching and parsing.
9
9
  *
10
10
  * Tests:
11
11
  * - Fetch emotes
@@ -28,12 +28,12 @@ if (env.TWITCH_ID !== undefined && env.TWITCH_SECRET !== undefined) {
28
28
  twitchFetcher.fetchTwitchEmotes(56648155)
29
29
  ]).then(() => {
30
30
  const kappa = twitchFetcher.emotes.get('Kappa');
31
- assert.strictEqual(kappa.toLink(2), 'https://static-cdn.jtvnw.net/emoticons/v1/25/3.0');
31
+ assert.strictEqual(kappa.toLink(2), 'https://static-cdn.jtvnw.net/emoticons/v2/25/default/dark/3.0');
32
32
 
33
33
  const text = twitchParser.parse(':CoolCat:\n:tppD:');
34
34
  assert.strictEqual(text, [
35
- '![CoolCat](https://static-cdn.jtvnw.net/emoticons/v1/58127/1.0 "CoolCat")',
36
- '![tppD](https://static-cdn.jtvnw.net/emoticons/v1/307609315/1.0 "tppD")'
35
+ '![CoolCat](https://static-cdn.jtvnw.net/emoticons/v2/58127/default/dark/1.0 "CoolCat")',
36
+ '![tppD](https://static-cdn.jtvnw.net/emoticons/v2/307609315/default/dark/1.0 "tppD")'
37
37
  ].join('\n'));
38
38
  }).then(() => {
39
39
  console.log('Twitch emotes test was successful.');
@@ -61,43 +61,70 @@ try {
61
61
  }
62
62
 
63
63
  /**
64
+ * Test BetterTTV fetching and parsing.
65
+ *
64
66
  * Tests:
65
67
  * - Fetch emotes
66
68
  * - BTTV Global
67
69
  * - BTTV Channel (twitchplayspokemon)
68
- * - FFZ via user name (sylux98)
69
- * - FFZ via user ID (shizuka_natsume)
70
- *
71
70
  * - Parse to Markdown
72
71
  * - BTTV Global emote (SourPls)
73
72
  * - BTTV Channel emote (tppUrn)
74
73
  * - BTTV Shared emote (MODS)
75
- * - FFZ emote from user name (AWOOO)
76
- * - FFZ emote from user ID (SanaeSip)
77
74
  */
78
- const fetcher = new EmoteFetcher();
79
- const parser = new EmoteParser(fetcher, {
75
+ const bttvFetcher = new EmoteFetcher();
76
+ const bttvParser = new EmoteParser(bttvFetcher, {
80
77
  type: 'markdown',
81
78
  match: /:(.+?):/g
82
79
  });
83
80
 
84
81
  Promise.all([
85
- fetcher.fetchBTTVEmotes(),
86
- fetcher.fetchBTTVEmotes(56648155),
87
- fetcher.fetchFFZEmotes('sylux98'),
88
- fetcher.fetchFFZEmotes(13638332)
82
+ bttvFetcher.fetchBTTVEmotes(),
83
+ bttvFetcher.fetchBTTVEmotes(56648155)
89
84
  ]).then(() => {
90
- const text = parser.parse(':SourPls:\n:tppUrn:\n:MODS:\n:AWOOO:\n:SanaeSip:');
85
+ const text = bttvParser.parse(':SourPls:\n:tppUrn:\n:MODS:');
91
86
  assert.strictEqual(text, [
92
87
  '![SourPls](https://cdn.betterttv.net/emote/566ca38765dbbdab32ec0560/1x "SourPls")',
93
88
  '![tppUrn](https://cdn.betterttv.net/emote/5f5f7d5f68d9d86c020e8672/1x "tppUrn")',
94
- '![MODS](https://cdn.betterttv.net/emote/5f2c4f9e65fe924464ef6d61/1x "MODS")',
89
+ '![MODS](https://cdn.betterttv.net/emote/5f2c4f9e65fe924464ef6d61/1x "MODS")'
90
+ ].join('\n'));
91
+ }).then(() => {
92
+ console.log('BTTV emotes test was successful.');
93
+ }).catch(err => {
94
+ console.error('BTTV emotes test failed!');
95
+ console.error(err);
96
+ });
97
+
98
+
99
+ /**
100
+ * Test FrankerFaceZ fetching and parsing.
101
+ *
102
+ * Tests:
103
+ * - Fetch emotes
104
+ * - FFZ via user name (sylux98)
105
+ * - FFZ via user ID (shizuka_natsume)
106
+ * - Parse to Markdown
107
+ * - FFZ emote from user name (AWOOO)
108
+ * - FFZ emote from user ID (SanaeSip)
109
+ */
110
+ const ffzFetcher = new EmoteFetcher();
111
+ const ffzParser = new EmoteParser(ffzFetcher, {
112
+ type: 'markdown',
113
+ match: /:(.+?):/g
114
+ });
115
+
116
+ Promise.all([
117
+ ffzFetcher.fetchFFZEmotes('sylux98'),
118
+ ffzFetcher.fetchFFZEmotes(13638332)
119
+ ]).then(() => {
120
+ const text = ffzParser.parse(':AWOOO:\n:SanaeSip:');
121
+ assert.strictEqual(text, [
95
122
  '![AWOOO](https://cdn.frankerfacez.com/emote/67/1 "AWOOO")',
96
123
  '![SanaeSip](https://cdn.frankerfacez.com/emote/305078/1 "SanaeSip")'
97
124
  ].join('\n'));
98
125
  }).then(() => {
99
- console.log('BTTV/FFZ emotes test was successful.');
126
+ console.log('FFZ emotes test was successful.');
100
127
  }).catch(err => {
101
- console.error('BTTV/FFZ emotes test failed!');
128
+ console.error('FFZ emotes test failed!');
102
129
  console.error(err);
103
130
  });