@mkody/twitch-emoticons 2.9.3 → 2.9.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.
- package/.jsdoc.json +12 -5
- package/.nvmrc +1 -1
- package/dist/TwitchEmoticons.min.js +11 -11
- package/dist/TwitchEmoticons.min.js.map +4 -4
- package/docs/BTTVEmote.html +72 -72
- package/docs/Channel.html +19 -19
- package/docs/Collection.html +25 -25
- package/docs/Emote.html +63 -33
- package/docs/EmoteFetcher.html +426 -366
- package/docs/EmoteParser.html +378 -3
- package/docs/FFZEmote.html +82 -82
- package/docs/SevenTVEmote.html +77 -77
- package/docs/TwitchEmote.html +68 -68
- package/docs/index.html +3 -3
- package/docs/struct_BTTVEmote.js.html +2 -2
- package/docs/struct_Channel.js.html +2 -2
- package/docs/struct_Emote.js.html +3 -2
- package/docs/struct_EmoteFetcher.js.html +4 -2
- package/docs/struct_EmoteParser.js.html +22 -3
- package/docs/struct_FFZEmote.js.html +2 -2
- package/docs/struct_SevenTVEmote.js.html +2 -2
- package/docs/struct_TwitchEmote.js.html +2 -2
- package/docs/util_Collection.js.html +4 -3
- package/package.json +14 -14
- package/src/struct/Emote.js +1 -0
- package/src/struct/EmoteFetcher.js +2 -0
- package/src/struct/EmoteParser.js +20 -1
- package/src/util/Collection.js +1 -0
- package/test/SevenTV.test.js +4 -4
- package/test/__snapshots__/ToFromObject.test.js.snap +1 -1
- package/test/other.test.js +60 -1
- package/typings/index.d.ts +4 -4
- package/docs/SevenTV.html +0 -1191
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -119,7 +119,7 @@ module.exports = Channel;
|
|
|
119
119
|
<br class="clear">
|
|
120
120
|
|
|
121
121
|
<footer>
|
|
122
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
122
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
123
123
|
</footer>
|
|
124
124
|
|
|
125
125
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
* @param {Channel} channel - Channel this emote belongs to.
|
|
53
53
|
* @param {string} id - ID of the emote.
|
|
54
54
|
* @param {data} data - The raw emote data.
|
|
55
|
+
* @throws {Error} When trying to use the base Emote class directly.
|
|
55
56
|
*/
|
|
56
57
|
constructor(channel, id, data) {
|
|
57
58
|
if (new.target.name === Emote.name) {
|
|
@@ -145,7 +146,7 @@ module.exports = Emote;
|
|
|
145
146
|
<br class="clear">
|
|
146
147
|
|
|
147
148
|
<footer>
|
|
148
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
149
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
149
150
|
</footer>
|
|
150
151
|
|
|
151
152
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -112,6 +112,7 @@ class EmoteFetcher {
|
|
|
112
112
|
* @private
|
|
113
113
|
* @param {int} channel_id - ID of the channel.
|
|
114
114
|
* @param {string} [format=null] - The type file format to use (webp/avif).
|
|
115
|
+
* @throws {Error} When Twitch Client ID or Client Secret were not provided.
|
|
115
116
|
* @returns {Channel}
|
|
116
117
|
*/
|
|
117
118
|
_setupChannel(channel_id, format = null) {
|
|
@@ -373,6 +374,7 @@ class EmoteFetcher {
|
|
|
373
374
|
/**
|
|
374
375
|
* Converts emote Objects to emotes
|
|
375
376
|
* @param {object} [emotesArray] - An array of emote objects
|
|
377
|
+
* @throws {TypeError} When an emote has an unknown type.
|
|
376
378
|
* @returns {Emote[]}
|
|
377
379
|
*/
|
|
378
380
|
fromObject(emotesArray) {
|
|
@@ -414,7 +416,7 @@ module.exports = EmoteFetcher;
|
|
|
414
416
|
<br class="clear">
|
|
415
417
|
|
|
416
418
|
<footer>
|
|
417
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
419
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
418
420
|
</footer>
|
|
419
421
|
|
|
420
422
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -52,7 +52,7 @@ class EmoteParser {
|
|
|
52
52
|
* A parser to replace text with emotes.
|
|
53
53
|
* @param {EmoteFetcher} fetcher - The fetcher to use the cache of.
|
|
54
54
|
* @param {object} [options={}] - Options for the parser.
|
|
55
|
-
* @param {string} [options.template] - The template to be used.
|
|
55
|
+
* @param {string} [options.template=''] - The template to be used.
|
|
56
56
|
* The strings that can be interpolated are:
|
|
57
57
|
* - `{link}` The link of the emote.
|
|
58
58
|
* - `{name}` The name of the emote.
|
|
@@ -84,6 +84,25 @@ class EmoteParser {
|
|
|
84
84
|
this._validateOptions(this.options);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Validates the parser options.
|
|
89
|
+
* @private
|
|
90
|
+
* @param {object} [options] - Options for the parser.
|
|
91
|
+
* @param {string} [options.template] - The template to be used.
|
|
92
|
+
* The strings that can be interpolated are:
|
|
93
|
+
* - `{link}` The link of the emote.
|
|
94
|
+
* - `{name}` The name of the emote.
|
|
95
|
+
* - `{size}` The size of the image.
|
|
96
|
+
* - `{creator}` The channel/owner name of the emote.
|
|
97
|
+
* @param {string} [options.type] - The type of the parser.
|
|
98
|
+
* Can be one of `markdown`, `html`, `bbcode`, or `plain`.
|
|
99
|
+
* If the `template` option is provided, this is ignored.
|
|
100
|
+
* @param {RegExp} [options.match] - The regular expression that matches an emote.
|
|
101
|
+
* Must be a global regex, with one capture group for the emote code.
|
|
102
|
+
* @throws {TypeError} When template is not a string.
|
|
103
|
+
* @throws {TypeError} When type is not one of the supported types.
|
|
104
|
+
* @throws {TypeError} When match is not a global RegExp.
|
|
105
|
+
*/
|
|
87
106
|
_validateOptions(options) {
|
|
88
107
|
if (options.template && typeof options.template !== 'string') {
|
|
89
108
|
throw new TypeError('Template must be a string');
|
|
@@ -140,7 +159,7 @@ module.exports = EmoteParser;
|
|
|
140
159
|
<br class="clear">
|
|
141
160
|
|
|
142
161
|
<footer>
|
|
143
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
162
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
144
163
|
</footer>
|
|
145
164
|
|
|
146
165
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -172,7 +172,7 @@ module.exports = FFZEmote;
|
|
|
172
172
|
<br class="clear">
|
|
173
173
|
|
|
174
174
|
<footer>
|
|
175
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
175
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
176
176
|
</footer>
|
|
177
177
|
|
|
178
178
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -167,7 +167,7 @@ module.exports = SevenTVEmote;
|
|
|
167
167
|
<br class="clear">
|
|
168
168
|
|
|
169
169
|
<footer>
|
|
170
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
170
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
171
171
|
</footer>
|
|
172
172
|
|
|
173
173
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -146,7 +146,7 @@ module.exports = TwitchEmote;
|
|
|
146
146
|
<br class="clear">
|
|
147
147
|
|
|
148
148
|
<footer>
|
|
149
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
149
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
150
150
|
</footer>
|
|
151
151
|
|
|
152
152
|
<script>prettyPrint();</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/mkody/twitch-emoticons" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
|
|
46
46
|
<section>
|
|
47
47
|
<article>
|
|
48
|
-
<pre class="prettyprint source linenums"><code
|
|
48
|
+
<pre class="prettyprint source linenums"><code>/* eslint-disable jsdoc/reject-function-type, jsdoc/reject-any-type */
|
|
49
|
+
/**
|
|
49
50
|
* An extended Map with utility methods.
|
|
50
51
|
* @class Collection
|
|
51
52
|
*/
|
|
@@ -137,7 +138,7 @@ module.exports = Collection;
|
|
|
137
138
|
<br class="clear">
|
|
138
139
|
|
|
139
140
|
<footer>
|
|
140
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
141
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
141
142
|
</footer>
|
|
142
143
|
|
|
143
144
|
<script>prettyPrint();</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkody/twitch-emoticons",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.5",
|
|
4
4
|
"description": "Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "typings/index.d.ts",
|
|
@@ -26,26 +26,26 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@twurple/api": "^7.
|
|
30
|
-
"@twurple/auth": "^7.
|
|
31
|
-
"axios": "^1.
|
|
29
|
+
"@twurple/api": "^7.4.0",
|
|
30
|
+
"@twurple/auth": "^7.4.0",
|
|
31
|
+
"axios": "^1.13.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@eslint/js": "^9.
|
|
35
|
-
"@jest/globals": "^30.0
|
|
34
|
+
"@eslint/js": "^9.39.1",
|
|
35
|
+
"@jest/globals": "^30.2.0",
|
|
36
36
|
"@microsoft/eslint-formatter-sarif": "^3.1.0",
|
|
37
37
|
"docdash": "^2.0.2",
|
|
38
|
-
"esbuild": "^0.
|
|
39
|
-
"eslint": "^9.
|
|
40
|
-
"eslint-plugin-jsdoc": "^
|
|
41
|
-
"globals": "^16.
|
|
42
|
-
"jest": "^30.0
|
|
43
|
-
"jsdoc": "^4.0.
|
|
38
|
+
"esbuild": "^0.27.0",
|
|
39
|
+
"eslint": "^9.39.1",
|
|
40
|
+
"eslint-plugin-jsdoc": "^61.4.1",
|
|
41
|
+
"globals": "^16.5.0",
|
|
42
|
+
"jest": "^30.2.0",
|
|
43
|
+
"jsdoc": "^4.0.5"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"all": "pnpm run lint && pnpm run test && pnpm run build && pnpm run docs",
|
|
47
47
|
"build": "esbuild ./src/index.js --bundle --minify --keep-names --sourcemap --format=esm --outfile=./dist/TwitchEmoticons.min.js",
|
|
48
|
-
"docs": "jsdoc --configure .jsdoc.json
|
|
48
|
+
"docs": "jsdoc --configure .jsdoc.json",
|
|
49
49
|
"lint": "eslint ./src ./test",
|
|
50
50
|
"test": "jest"
|
|
51
51
|
},
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"node": ">=18.0.0",
|
|
66
66
|
"pnpm": ">=9"
|
|
67
67
|
},
|
|
68
|
-
"packageManager": "pnpm@10.
|
|
68
|
+
"packageManager": "pnpm@10.24.0",
|
|
69
69
|
"pnpm": {
|
|
70
70
|
"onlyBuiltDependencies": [
|
|
71
71
|
"esbuild",
|
package/src/struct/Emote.js
CHANGED
|
@@ -5,6 +5,7 @@ class Emote {
|
|
|
5
5
|
* @param {Channel} channel - Channel this emote belongs to.
|
|
6
6
|
* @param {string} id - ID of the emote.
|
|
7
7
|
* @param {data} data - The raw emote data.
|
|
8
|
+
* @throws {Error} When trying to use the base Emote class directly.
|
|
8
9
|
*/
|
|
9
10
|
constructor(channel, id, data) {
|
|
10
11
|
if (new.target.name === Emote.name) {
|
|
@@ -65,6 +65,7 @@ class EmoteFetcher {
|
|
|
65
65
|
* @private
|
|
66
66
|
* @param {int} channel_id - ID of the channel.
|
|
67
67
|
* @param {string} [format=null] - The type file format to use (webp/avif).
|
|
68
|
+
* @throws {Error} When Twitch Client ID or Client Secret were not provided.
|
|
68
69
|
* @returns {Channel}
|
|
69
70
|
*/
|
|
70
71
|
_setupChannel(channel_id, format = null) {
|
|
@@ -326,6 +327,7 @@ class EmoteFetcher {
|
|
|
326
327
|
/**
|
|
327
328
|
* Converts emote Objects to emotes
|
|
328
329
|
* @param {object} [emotesArray] - An array of emote objects
|
|
330
|
+
* @throws {TypeError} When an emote has an unknown type.
|
|
329
331
|
* @returns {Emote[]}
|
|
330
332
|
*/
|
|
331
333
|
fromObject(emotesArray) {
|
|
@@ -5,7 +5,7 @@ class EmoteParser {
|
|
|
5
5
|
* A parser to replace text with emotes.
|
|
6
6
|
* @param {EmoteFetcher} fetcher - The fetcher to use the cache of.
|
|
7
7
|
* @param {object} [options={}] - Options for the parser.
|
|
8
|
-
* @param {string} [options.template] - The template to be used.
|
|
8
|
+
* @param {string} [options.template=''] - The template to be used.
|
|
9
9
|
* The strings that can be interpolated are:
|
|
10
10
|
* - `{link}` The link of the emote.
|
|
11
11
|
* - `{name}` The name of the emote.
|
|
@@ -37,6 +37,25 @@ class EmoteParser {
|
|
|
37
37
|
this._validateOptions(this.options);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Validates the parser options.
|
|
42
|
+
* @private
|
|
43
|
+
* @param {object} [options] - Options for the parser.
|
|
44
|
+
* @param {string} [options.template] - The template to be used.
|
|
45
|
+
* The strings that can be interpolated are:
|
|
46
|
+
* - `{link}` The link of the emote.
|
|
47
|
+
* - `{name}` The name of the emote.
|
|
48
|
+
* - `{size}` The size of the image.
|
|
49
|
+
* - `{creator}` The channel/owner name of the emote.
|
|
50
|
+
* @param {string} [options.type] - The type of the parser.
|
|
51
|
+
* Can be one of `markdown`, `html`, `bbcode`, or `plain`.
|
|
52
|
+
* If the `template` option is provided, this is ignored.
|
|
53
|
+
* @param {RegExp} [options.match] - The regular expression that matches an emote.
|
|
54
|
+
* Must be a global regex, with one capture group for the emote code.
|
|
55
|
+
* @throws {TypeError} When template is not a string.
|
|
56
|
+
* @throws {TypeError} When type is not one of the supported types.
|
|
57
|
+
* @throws {TypeError} When match is not a global RegExp.
|
|
58
|
+
*/
|
|
40
59
|
_validateOptions(options) {
|
|
41
60
|
if (options.template && typeof options.template !== 'string') {
|
|
42
61
|
throw new TypeError('Template must be a string');
|
package/src/util/Collection.js
CHANGED
package/test/SevenTV.test.js
CHANGED
|
@@ -15,12 +15,12 @@ describe('Test 7TV emotes', () => {
|
|
|
15
15
|
|
|
16
16
|
test('Get emote (EZ)', () => {
|
|
17
17
|
const emote = emoteFetcher.emotes.get('EZ');
|
|
18
|
-
expect(emote.toLink(2)).toBe('https://cdn.7tv.app/emote/
|
|
18
|
+
expect(emote.toLink(2)).toBe('https://cdn.7tv.app/emote/01GCVYNF0G000D8RDSXFWM2E0J/3x.webp');
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
test('Parse string with emote (EZ)', () => {
|
|
22
22
|
const text = emoteParser.parse('This is a test string with :EZ: in it.');
|
|
23
|
-
expect(text).toBe('This is a test string with .toBe('This is a test string with  in it.');
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -37,12 +37,12 @@ describe('Test 7TV emotes', () => {
|
|
|
37
37
|
|
|
38
38
|
test('Get emote (Clap)', () => {
|
|
39
39
|
const emote = emoteFetcher.emotes.get('Clap');
|
|
40
|
-
expect(emote.toLink(2)).toBe('https://cdn.7tv.app/emote/
|
|
40
|
+
expect(emote.toLink(2)).toBe('https://cdn.7tv.app/emote/01GHE0JD4G000AV9TSJ0TJ6D67/3x.avif');
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
test('Parse string with emote (Clap)', () => {
|
|
44
44
|
const text = emoteParser.parse('This is a test string with :Clap: in it.');
|
|
45
|
-
expect(text).toBe('This is a test string with .toBe('This is a test string with  in it.');
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
48
|
|