@mkody/twitch-emoticons 2.6.2 → 2.7.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 +13 -8
- package/docs/BTTVEmote.html +1319 -1241
- package/docs/Channel.html +823 -823
- package/docs/Collection.html +797 -797
- package/docs/Emote.html +801 -801
- package/docs/EmoteFetcher.html +2946 -2694
- package/docs/EmoteParser.html +811 -811
- package/docs/FFZEmote.html +1473 -1317
- package/docs/SevenTVEmote.html +1395 -1317
- package/docs/TwitchEmote.html +1315 -1237
- package/docs/index.html +206 -201
- package/docs/struct_BTTVEmote.js.html +79 -73
- package/docs/struct_Channel.js.html +72 -72
- package/docs/struct_Emote.js.html +73 -72
- package/docs/struct_EmoteFetcher.js.html +121 -77
- package/docs/struct_EmoteParser.js.html +73 -72
- package/docs/struct_FFZEmote.js.html +87 -74
- package/docs/struct_SevenTVEmote.js.html +79 -73
- package/docs/struct_TwitchEmote.js.html +79 -73
- package/docs/util_Collection.js.html +72 -72
- package/package.json +4 -4
- package/src/struct/BTTVEmote.js +7 -1
- package/src/struct/Emote.js +1 -0
- package/src/struct/EmoteFetcher.js +49 -5
- package/src/struct/EmoteParser.js +1 -0
- package/src/struct/FFZEmote.js +15 -2
- package/src/struct/SevenTVEmote.js +7 -1
- package/src/struct/TwitchEmote.js +7 -1
- package/src/util/Constants.js +9 -3
- package/test/index.js +18 -10
- package/typings/index.d.ts +9 -4
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<title>struct/TwitchEmote.js - Documentation</title>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
-
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
-
<!--[if lt IE 9]>
|
|
12
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
-
<![endif]-->
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
-
<script src="scripts/nav.js" defer></script>
|
|
17
|
-
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
|
|
22
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
23
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
24
|
-
<div class="navicon"></div>
|
|
25
|
-
</label>
|
|
26
|
-
|
|
27
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
28
|
-
|
|
29
|
-
<nav >
|
|
30
|
-
|
|
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>
|
|
33
|
-
|
|
34
|
-
</nav>
|
|
35
|
-
|
|
36
|
-
<div id="main">
|
|
37
|
-
|
|
38
|
-
<h1 class="page-title">struct/TwitchEmote.js</h1>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<section>
|
|
47
|
-
<article>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>struct/TwitchEmote.js - Documentation</title>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
+
<!--[if lt IE 9]>
|
|
12
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
+
<![endif]-->
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
+
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
|
|
22
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
23
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
24
|
+
<div class="navicon"></div>
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
28
|
+
|
|
29
|
+
<nav >
|
|
30
|
+
|
|
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#_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
|
+
|
|
34
|
+
</nav>
|
|
35
|
+
|
|
36
|
+
<div id="main">
|
|
37
|
+
|
|
38
|
+
<h1 class="page-title">struct/TwitchEmote.js</h1>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<section>
|
|
47
|
+
<article>
|
|
48
48
|
<pre class="prettyprint source linenums"><code>const Emote = require('./Emote');
|
|
49
49
|
const Constants = require('../util/Constants');
|
|
50
50
|
|
|
@@ -79,11 +79,17 @@ class TwitchEmote extends Emote {
|
|
|
79
79
|
*/
|
|
80
80
|
this.set = data.emoticon_set;
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* If emote is animated.
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
*/
|
|
86
|
+
this.animated = 'animated' in data.formats;
|
|
87
|
+
|
|
82
88
|
/**
|
|
83
89
|
* The image type of the emote.
|
|
84
90
|
* @type {string}
|
|
85
91
|
*/
|
|
86
|
-
this.imageType = 'png';
|
|
92
|
+
this.imageType = 'animated' in data.formats ? 'gif' : 'png';
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
/**
|
|
@@ -97,28 +103,28 @@ class TwitchEmote extends Emote {
|
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
module.exports = TwitchEmote;
|
|
100
|
-
</code></pre>
|
|
101
|
-
</article>
|
|
102
|
-
</section>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
<br class="clear">
|
|
112
|
-
|
|
113
|
-
<footer>
|
|
114
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
115
|
-
</footer>
|
|
116
|
-
|
|
117
|
-
<script>prettyPrint();</script>
|
|
118
|
-
<script src="scripts/polyfill.js"></script>
|
|
119
|
-
<script src="scripts/linenumber.js"></script>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
</body>
|
|
124
|
-
</html>
|
|
106
|
+
</code></pre>
|
|
107
|
+
</article>
|
|
108
|
+
</section>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<br class="clear">
|
|
118
|
+
|
|
119
|
+
<footer>
|
|
120
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
121
|
+
</footer>
|
|
122
|
+
|
|
123
|
+
<script>prettyPrint();</script>
|
|
124
|
+
<script src="scripts/polyfill.js"></script>
|
|
125
|
+
<script src="scripts/linenumber.js"></script>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</body>
|
|
130
|
+
</html>
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<title>util/Collection.js - Documentation</title>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
-
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
-
<!--[if lt IE 9]>
|
|
12
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
-
<![endif]-->
|
|
14
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
-
<script src="scripts/nav.js" defer></script>
|
|
17
|
-
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
|
|
22
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
23
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
24
|
-
<div class="navicon"></div>
|
|
25
|
-
</label>
|
|
26
|
-
|
|
27
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
28
|
-
|
|
29
|
-
<nav >
|
|
30
|
-
|
|
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>
|
|
33
|
-
|
|
34
|
-
</nav>
|
|
35
|
-
|
|
36
|
-
<div id="main">
|
|
37
|
-
|
|
38
|
-
<h1 class="page-title">util/Collection.js</h1>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<section>
|
|
47
|
-
<article>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>util/Collection.js - Documentation</title>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
+
<!--[if lt IE 9]>
|
|
12
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
+
<![endif]-->
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
+
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
|
|
22
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
23
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
24
|
+
<div class="navicon"></div>
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
28
|
+
|
|
29
|
+
<nav >
|
|
30
|
+
|
|
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#_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
|
+
|
|
34
|
+
</nav>
|
|
35
|
+
|
|
36
|
+
<div id="main">
|
|
37
|
+
|
|
38
|
+
<h1 class="page-title">util/Collection.js</h1>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<section>
|
|
47
|
+
<article>
|
|
48
48
|
<pre class="prettyprint source linenums"><code>/**
|
|
49
49
|
* An extended Map with utility methods.
|
|
50
50
|
* @class Collection
|
|
@@ -123,28 +123,28 @@ class Collection extends Map {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
module.exports = Collection;
|
|
126
|
-
</code></pre>
|
|
127
|
-
</article>
|
|
128
|
-
</section>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
<br class="clear">
|
|
138
|
-
|
|
139
|
-
<footer>
|
|
140
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
141
|
-
</footer>
|
|
142
|
-
|
|
143
|
-
<script>prettyPrint();</script>
|
|
144
|
-
<script src="scripts/polyfill.js"></script>
|
|
145
|
-
<script src="scripts/linenumber.js"></script>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
</body>
|
|
150
|
-
</html>
|
|
126
|
+
</code></pre>
|
|
127
|
+
</article>
|
|
128
|
+
</section>
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<br class="clear">
|
|
138
|
+
|
|
139
|
+
<footer>
|
|
140
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
141
|
+
</footer>
|
|
142
|
+
|
|
143
|
+
<script>prettyPrint();</script>
|
|
144
|
+
<script src="scripts/polyfill.js"></script>
|
|
145
|
+
<script src="scripts/linenumber.js"></script>
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
</body>
|
|
150
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkody/twitch-emoticons",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
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",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@twurple/api": "^6.0.
|
|
29
|
-
"@twurple/auth": "^6.0.
|
|
28
|
+
"@twurple/api": "^6.0.9",
|
|
29
|
+
"@twurple/auth": "^6.0.9",
|
|
30
30
|
"got": "^11.8.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"docdash": "^2.0.1",
|
|
34
|
-
"eslint": "^8.
|
|
34
|
+
"eslint": "^8.36.0",
|
|
35
35
|
"jsdoc": "^4.0.2"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
package/src/struct/BTTVEmote.js
CHANGED
|
@@ -34,11 +34,17 @@ class BTTVEmote extends Emote {
|
|
|
34
34
|
*/
|
|
35
35
|
this.ownerName = 'user' in data ? data.user.name : null;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* If emote is animated.
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
*/
|
|
41
|
+
this.animated = data.animated;
|
|
42
|
+
|
|
37
43
|
/**
|
|
38
44
|
* The image type of the emote.
|
|
39
45
|
* @type {string}
|
|
40
46
|
*/
|
|
41
|
-
this.imageType =
|
|
47
|
+
this.imageType = 'webp';
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
/**
|
package/src/struct/Emote.js
CHANGED
|
@@ -43,6 +43,12 @@ class EmoteFetcher {
|
|
|
43
43
|
* @type {Collection<string, Channel>}
|
|
44
44
|
*/
|
|
45
45
|
this.channels = new Collection();
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Save if we fetched FFZ's modifier emotes once.
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
*/
|
|
51
|
+
this.ffzModifiersFetched = false;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
/**
|
|
@@ -132,6 +138,20 @@ class EmoteFetcher {
|
|
|
132
138
|
return emote;
|
|
133
139
|
}
|
|
134
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Gets the raw FFZ emote data from a set.
|
|
143
|
+
* @private
|
|
144
|
+
* @param {int} id - ID of the set.
|
|
145
|
+
* @returns {Promise<Object[]>}
|
|
146
|
+
*/
|
|
147
|
+
_getRawFFZEmoteSet(id) {
|
|
148
|
+
const endpoint = Constants.FFZ.Set(id); // eslint-disable-line new-cap
|
|
149
|
+
|
|
150
|
+
return got(endpoint, options).then(req => {
|
|
151
|
+
return req.body.set.emoticons;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
135
155
|
/**
|
|
136
156
|
* Gets the raw FFZ emotes data for a channel.
|
|
137
157
|
* @private
|
|
@@ -180,8 +200,8 @@ class EmoteFetcher {
|
|
|
180
200
|
*/
|
|
181
201
|
_getRawSevenTVEmotes(id) {
|
|
182
202
|
const endpoint = !id
|
|
183
|
-
? Constants.
|
|
184
|
-
: Constants.
|
|
203
|
+
? Constants.SevenTV.Global
|
|
204
|
+
: Constants.SevenTV.Channel(id); // eslint-disable-line new-cap
|
|
185
205
|
|
|
186
206
|
return got(endpoint, options).then(req => req.body);
|
|
187
207
|
}
|
|
@@ -217,7 +237,9 @@ class EmoteFetcher {
|
|
|
217
237
|
fetchTwitchEmotes(channel = null) {
|
|
218
238
|
return this._getRawTwitchEmotes(channel).then(rawEmotes => {
|
|
219
239
|
for (const emote of rawEmotes) {
|
|
220
|
-
this._cacheTwitchEmote(channel, {
|
|
240
|
+
this._cacheTwitchEmote(channel, {
|
|
241
|
+
code: emote.name, id: emote.id, formats: emote.formats
|
|
242
|
+
});
|
|
221
243
|
}
|
|
222
244
|
|
|
223
245
|
return this.channels.get(channel).emotes.filter(e => e.type === 'twitch');
|
|
@@ -242,10 +264,32 @@ class EmoteFetcher {
|
|
|
242
264
|
|
|
243
265
|
/**
|
|
244
266
|
* Fetches the FFZ emotes for a channel.
|
|
245
|
-
* @param {int} channel - ID of the channel.
|
|
267
|
+
* @param {int} [channel=null] - ID of the channel.
|
|
246
268
|
* @returns {Promise<Collection<string, FFZEmote>>}
|
|
247
269
|
*/
|
|
248
|
-
fetchFFZEmotes(channel) {
|
|
270
|
+
async fetchFFZEmotes(channel) {
|
|
271
|
+
// Fetch modifier emotes at least once
|
|
272
|
+
if (!this.ffzModifiersFetched) {
|
|
273
|
+
this.ffzModifiersFetched = true;
|
|
274
|
+
|
|
275
|
+
await this._getRawFFZEmoteSet(Constants.FFZ.sets.Modifiers).then(rawEmotes => {
|
|
276
|
+
for (const data of rawEmotes) {
|
|
277
|
+
this._cacheFFZEmote(null, data);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// If no channel specified, fetch the Global set
|
|
283
|
+
if (!channel) {
|
|
284
|
+
return this._getRawFFZEmoteSet(Constants.FFZ.sets.Global).then(rawEmotes => {
|
|
285
|
+
for (const data of rawEmotes) {
|
|
286
|
+
this._cacheFFZEmote(channel, data);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return this.channels.get(channel).emotes.filter(e => e.type === 'ffz');
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
249
293
|
return this._getRawFFZEmotes(channel).then(rawEmotes => {
|
|
250
294
|
for (const data of rawEmotes) {
|
|
251
295
|
this._cacheFFZEmote(channel, data);
|
|
@@ -61,6 +61,7 @@ class EmoteParser {
|
|
|
61
61
|
const parsed = text.replace(this.options.match, (matched, id) => {
|
|
62
62
|
const emote = this.fetcher.emotes.get(id);
|
|
63
63
|
if (!emote) return matched;
|
|
64
|
+
if (emote.modifier) return '';
|
|
64
65
|
|
|
65
66
|
const template = this.options.template || Constants.Templates[this.options.type];
|
|
66
67
|
const link = emote.toLink(size);
|
package/src/struct/FFZEmote.js
CHANGED
|
@@ -38,13 +38,25 @@ class FFZEmote extends Emote {
|
|
|
38
38
|
* Available image sizes.
|
|
39
39
|
* @type {string[]}
|
|
40
40
|
*/
|
|
41
|
-
this.sizes = Object.keys(data.urls);
|
|
41
|
+
this.sizes = 'animated' in data ? Object.keys(data.animated) : Object.keys(data.urls);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* If emote is animated.
|
|
45
|
+
* @type {boolean}
|
|
46
|
+
*/
|
|
47
|
+
this.animated = 'animated' in data;
|
|
42
48
|
|
|
43
49
|
/**
|
|
44
50
|
* The image type of the emote.
|
|
45
51
|
* @type {string}
|
|
46
52
|
*/
|
|
47
|
-
this.imageType = 'png';
|
|
53
|
+
this.imageType = 'animated' in data ? 'webp' : 'png';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* If the emote is a modifier and should be hidden.
|
|
57
|
+
* @type {boolean}
|
|
58
|
+
*/
|
|
59
|
+
this.modifier = data.modifier && (data.modifier_flags & 1) !== 0;
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
/**
|
|
@@ -54,6 +66,7 @@ class FFZEmote extends Emote {
|
|
|
54
66
|
*/
|
|
55
67
|
toLink(size = 0) {
|
|
56
68
|
size = this.sizes[size];
|
|
69
|
+
if (this.animated) return Constants.FFZ.CDNAnimated(this.id, size); // eslint-disable-line new-cap
|
|
57
70
|
return Constants.FFZ.CDN(this.id, size); // eslint-disable-line new-cap
|
|
58
71
|
}
|
|
59
72
|
}
|
|
@@ -42,6 +42,12 @@ class SevenTVEmote extends Emote {
|
|
|
42
42
|
.filter(el => el.format === this.channel.format.toUpperCase())
|
|
43
43
|
.map(el => el.name);
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* If emote is animated.
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
*/
|
|
49
|
+
this.animated = data.animated;
|
|
50
|
+
|
|
45
51
|
/**
|
|
46
52
|
* The image type of the emote.
|
|
47
53
|
* @type {string}
|
|
@@ -56,7 +62,7 @@ class SevenTVEmote extends Emote {
|
|
|
56
62
|
*/
|
|
57
63
|
toLink(size = 0) {
|
|
58
64
|
size = this.sizes[size];
|
|
59
|
-
return Constants.
|
|
65
|
+
return Constants.SevenTV.CDN(this.id, size); // eslint-disable-line new-cap
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -32,11 +32,17 @@ class TwitchEmote extends Emote {
|
|
|
32
32
|
*/
|
|
33
33
|
this.set = data.emoticon_set;
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* If emote is animated.
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
*/
|
|
39
|
+
this.animated = 'animated' in data.formats;
|
|
40
|
+
|
|
35
41
|
/**
|
|
36
42
|
* The image type of the emote.
|
|
37
43
|
* @type {string}
|
|
38
44
|
*/
|
|
39
|
-
this.imageType = 'png';
|
|
45
|
+
this.imageType = 'animated' in data.formats ? 'gif' : 'png';
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
/**
|
package/src/util/Constants.js
CHANGED
|
@@ -5,16 +5,22 @@ module.exports = {
|
|
|
5
5
|
BTTV: {
|
|
6
6
|
Global: 'https://api.betterttv.net/3/cached/emotes/global',
|
|
7
7
|
Channel: id => `https://api.betterttv.net/3/cached/users/twitch/${id}`,
|
|
8
|
-
CDN: (id, size) => `https://cdn.betterttv.net/emote/${id}/${size + 1}x`
|
|
8
|
+
CDN: (id, size) => `https://cdn.betterttv.net/emote/${id}/${size + 1}x.webp`
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
SevenTV: {
|
|
11
11
|
Global: 'https://7tv.io/v3/emote-sets/global',
|
|
12
12
|
Channel: id => `https://7tv.io/v3/users/twitch/${id}`,
|
|
13
13
|
CDN: (id, size) => `https://cdn.7tv.app/emote/${id}/${size}`
|
|
14
14
|
},
|
|
15
15
|
FFZ: {
|
|
16
|
+
sets: {
|
|
17
|
+
Global: 3,
|
|
18
|
+
Modifiers: 1532818
|
|
19
|
+
},
|
|
20
|
+
Set: id => `https://api.frankerfacez.com/v1/set/${id}`,
|
|
16
21
|
Channel: id => `https://api.frankerfacez.com/v1/room/id/${id}`,
|
|
17
|
-
CDN: (id, size) => `https://cdn.frankerfacez.com/emote/${id}/${size}
|
|
22
|
+
CDN: (id, size) => `https://cdn.frankerfacez.com/emote/${id}/${size}`,
|
|
23
|
+
CDNAnimated: (id, size) => `https://cdn.frankerfacez.com/emote/${id}/animated/${size}.webp`
|
|
18
24
|
},
|
|
19
25
|
Templates: {
|
|
20
26
|
html: '<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',
|