@mkody/twitch-emoticons 2.6.2 → 2.7.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/.eslintrc.json +143 -143
- package/.github/codeql/codeql-config.yml +4 -4
- package/.github/workflows/codeql.yml +50 -50
- package/.github/workflows/eslint.yml +50 -50
- package/.github/workflows/release.yml +22 -0
- package/.github/workflows/yarn-test.yml +17 -17
- package/.jsdoc.json +39 -39
- package/.nvmrc +1 -0
- package/LICENSE +22 -22
- package/README.md +13 -8
- package/docs/BTTVEmote.html +83 -5
- package/docs/Channel.html +1 -1
- package/docs/Collection.html +1 -1
- package/docs/Emote.html +3 -3
- package/docs/EmoteFetcher.html +271 -19
- package/docs/EmoteParser.html +1 -1
- package/docs/FFZEmote.html +162 -6
- package/docs/SevenTV.html +1190 -1190
- package/docs/SevenTVEmote.html +84 -6
- package/docs/TwitchEmote.html +83 -5
- package/docs/index.html +15 -10
- package/docs/struct_BTTVEmote.js.html +61 -55
- package/docs/struct_Channel.js.html +56 -56
- package/docs/struct_Emote.js.html +67 -66
- package/docs/struct_EmoteFetcher.js.html +324 -284
- package/docs/struct_EmoteParser.js.html +82 -81
- package/docs/struct_FFZEmote.js.html +75 -62
- package/docs/struct_SevenTVEmote.js.html +70 -64
- package/docs/struct_TwitchEmote.js.html +59 -53
- package/docs/util_Collection.js.html +79 -79
- package/package.json +57 -57
- package/src/index.js +12 -12
- package/src/struct/BTTVEmote.js +60 -54
- package/src/struct/Channel.js +55 -55
- package/src/struct/Emote.js +66 -65
- package/src/struct/EmoteFetcher.js +323 -283
- package/src/struct/EmoteParser.js +81 -80
- package/src/struct/FFZEmote.js +74 -61
- package/src/struct/SevenTVEmote.js +69 -63
- package/src/struct/TwitchEmote.js +58 -52
- package/src/util/Collection.js +78 -78
- package/src/util/Constants.js +31 -25
- package/test/index.js +174 -166
- package/typings/index.d.ts +98 -93
|
@@ -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#toString">toString</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="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</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#fetchTwitchEmotes">fetchTwitchEmotes</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#toString">toString</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#toString">toString</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#toString">toString</a></li></ul></li></ul>
|
|
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#toString">toString</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="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</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#fetchTwitchEmotes">fetchTwitchEmotes</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#toString">toString</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#toString">toString</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#toString">toString</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -45,61 +45,61 @@
|
|
|
45
45
|
|
|
46
46
|
<section>
|
|
47
47
|
<article>
|
|
48
|
-
<pre class="prettyprint source linenums"><code>const Collection = require('../util/Collection');
|
|
49
|
-
|
|
50
|
-
class Channel {
|
|
51
|
-
/**
|
|
52
|
-
* A Twitch channel.
|
|
53
|
-
* @param {EmoteFetcher} fetcher - The emote fetcher.
|
|
54
|
-
* @param {int} id - ID of the channel.
|
|
55
|
-
*/
|
|
56
|
-
constructor(fetcher, id) {
|
|
57
|
-
/**
|
|
58
|
-
* The emote fetcher.
|
|
59
|
-
* @type {EmoteFetcher}
|
|
60
|
-
*/
|
|
61
|
-
this.fetcher = fetcher;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The ID of this channel.
|
|
65
|
-
* For the global channel, the ID will be null.
|
|
66
|
-
* @type {?int}
|
|
67
|
-
*/
|
|
68
|
-
this.channel_id = id;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Cached emotes belonging to this channel.
|
|
72
|
-
* @type {Collection<string, Emote>}
|
|
73
|
-
*/
|
|
74
|
-
this.emotes = new Collection();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Fetches the BTTV emotes for this channel.
|
|
79
|
-
* @returns {Promise<Collection<string, BTTVEmote>>}
|
|
80
|
-
*/
|
|
81
|
-
fetchBTTVEmotes() {
|
|
82
|
-
return this.fetcher.fetchBTTVEmotes(this.id);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Fetches the FFZ emotes for this channel.
|
|
87
|
-
* @returns {Promise<Collection<string, FFZEmote>>}
|
|
88
|
-
*/
|
|
89
|
-
fetchFFZEmotes() {
|
|
90
|
-
return this.fetcher.fetchFFZEmotes(this.id);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Fetches the 7TV emotes for this channel.
|
|
95
|
-
* @returns {Promise<Collection<string, SevenTVEmote>>}
|
|
96
|
-
*/
|
|
97
|
-
fetchSevenTVEmotes() {
|
|
98
|
-
return this.fetcher.fetchSevenTVEmotes(this.id);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
module.exports = Channel;
|
|
48
|
+
<pre class="prettyprint source linenums"><code>const Collection = require('../util/Collection');
|
|
49
|
+
|
|
50
|
+
class Channel {
|
|
51
|
+
/**
|
|
52
|
+
* A Twitch channel.
|
|
53
|
+
* @param {EmoteFetcher} fetcher - The emote fetcher.
|
|
54
|
+
* @param {int} id - ID of the channel.
|
|
55
|
+
*/
|
|
56
|
+
constructor(fetcher, id) {
|
|
57
|
+
/**
|
|
58
|
+
* The emote fetcher.
|
|
59
|
+
* @type {EmoteFetcher}
|
|
60
|
+
*/
|
|
61
|
+
this.fetcher = fetcher;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The ID of this channel.
|
|
65
|
+
* For the global channel, the ID will be null.
|
|
66
|
+
* @type {?int}
|
|
67
|
+
*/
|
|
68
|
+
this.channel_id = id;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Cached emotes belonging to this channel.
|
|
72
|
+
* @type {Collection<string, Emote>}
|
|
73
|
+
*/
|
|
74
|
+
this.emotes = new Collection();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Fetches the BTTV emotes for this channel.
|
|
79
|
+
* @returns {Promise<Collection<string, BTTVEmote>>}
|
|
80
|
+
*/
|
|
81
|
+
fetchBTTVEmotes() {
|
|
82
|
+
return this.fetcher.fetchBTTVEmotes(this.id);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Fetches the FFZ emotes for this channel.
|
|
87
|
+
* @returns {Promise<Collection<string, FFZEmote>>}
|
|
88
|
+
*/
|
|
89
|
+
fetchFFZEmotes() {
|
|
90
|
+
return this.fetcher.fetchFFZEmotes(this.id);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Fetches the 7TV emotes for this channel.
|
|
95
|
+
* @returns {Promise<Collection<string, SevenTVEmote>>}
|
|
96
|
+
*/
|
|
97
|
+
fetchSevenTVEmotes() {
|
|
98
|
+
return this.fetcher.fetchSevenTVEmotes(this.id);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = Channel;
|
|
103
103
|
</code></pre>
|
|
104
104
|
</article>
|
|
105
105
|
</section>
|
|
@@ -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#toString">toString</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="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</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#fetchTwitchEmotes">fetchTwitchEmotes</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#toString">toString</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#toString">toString</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#toString">toString</a></li></ul></li></ul>
|
|
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#toString">toString</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="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</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#fetchTwitchEmotes">fetchTwitchEmotes</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#toString">toString</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#toString">toString</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#toString">toString</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -45,71 +45,72 @@
|
|
|
45
45
|
|
|
46
46
|
<section>
|
|
47
47
|
<article>
|
|
48
|
-
<pre class="prettyprint source linenums"><code>class Emote {
|
|
49
|
-
/**
|
|
50
|
-
* Base class for emotes.
|
|
51
|
-
* This constructor is not to be used.
|
|
52
|
-
* @param {Channel} channel - Channel this emote belongs to.
|
|
53
|
-
* @param {string} id - ID of the emote.
|
|
54
|
-
* @param {data} data - The raw emote data.
|
|
55
|
-
*/
|
|
56
|
-
constructor(channel, id, data) {
|
|
57
|
-
if (new.target.name === Emote.name) {
|
|
58
|
-
throw new Error('Base Emote class cannot be used');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The emote fetcher.
|
|
63
|
-
* @type {EmoteFetcher}
|
|
64
|
-
*/
|
|
65
|
-
this.fetcher = channel.fetcher;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* The channel this emote belongs to.
|
|
69
|
-
* Only accurate and constant on Twitch emotes.
|
|
70
|
-
* For other types of emotes, use the `owner` or `ownerName` property.
|
|
71
|
-
* @type {Channel}
|
|
72
|
-
*/
|
|
73
|
-
this.channel = channel;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The ID of this emote.
|
|
77
|
-
* @type {string}
|
|
78
|
-
*/
|
|
79
|
-
this.id = id;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* The type of this emote.
|
|
83
|
-
* Either `twitch`, `bttv`, `ffz`, or '7tv'.
|
|
84
|
-
* @type {string}
|
|
85
|
-
*/
|
|
86
|
-
this.type = null;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
48
|
+
<pre class="prettyprint source linenums"><code>class Emote {
|
|
49
|
+
/**
|
|
50
|
+
* Base class for emotes.
|
|
51
|
+
* This constructor is not to be used.
|
|
52
|
+
* @param {Channel} channel - Channel this emote belongs to.
|
|
53
|
+
* @param {string} id - ID of the emote.
|
|
54
|
+
* @param {data} data - The raw emote data.
|
|
55
|
+
*/
|
|
56
|
+
constructor(channel, id, data) {
|
|
57
|
+
if (new.target.name === Emote.name) {
|
|
58
|
+
throw new Error('Base Emote class cannot be used');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The emote fetcher.
|
|
63
|
+
* @type {EmoteFetcher}
|
|
64
|
+
*/
|
|
65
|
+
this.fetcher = channel.fetcher;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The channel this emote belongs to.
|
|
69
|
+
* Only accurate and constant on Twitch emotes.
|
|
70
|
+
* For other types of emotes, use the `owner` or `ownerName` property.
|
|
71
|
+
* @type {Channel}
|
|
72
|
+
*/
|
|
73
|
+
this.channel = channel;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The ID of this emote.
|
|
77
|
+
* @type {string}
|
|
78
|
+
*/
|
|
79
|
+
this.id = id;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The type of this emote.
|
|
83
|
+
* Either `twitch`, `bttv`, `ffz`, or '7tv'.
|
|
84
|
+
* @type {string}
|
|
85
|
+
*/
|
|
86
|
+
this.type = null;
|
|
87
|
+
|
|
88
|
+
this._setup(data);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_setup(data) {
|
|
92
|
+
/**
|
|
93
|
+
* The code or name of the emote.
|
|
94
|
+
* @type {string}
|
|
95
|
+
*/
|
|
96
|
+
this.code = data.code;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
toLink() {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Override for `toString`.
|
|
105
|
+
* Will give the emote's name.
|
|
106
|
+
* @returns {string}
|
|
107
|
+
*/
|
|
108
|
+
toString() {
|
|
109
|
+
return this.code;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
module.exports = Emote;
|
|
113
114
|
</code></pre>
|
|
114
115
|
</article>
|
|
115
116
|
</section>
|