@mkody/twitch-emoticons 2.7.0 → 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/docs/BTTVEmote.html +1319 -1319
- package/docs/Channel.html +823 -823
- package/docs/Collection.html +797 -797
- package/docs/Emote.html +801 -801
- package/docs/EmoteFetcher.html +2946 -2946
- package/docs/EmoteParser.html +811 -811
- package/docs/FFZEmote.html +1473 -1473
- package/docs/SevenTV.html +1190 -1190
- package/docs/SevenTVEmote.html +1395 -1395
- package/docs/TwitchEmote.html +1315 -1315
- package/docs/index.html +206 -206
- package/docs/struct_BTTVEmote.js.html +132 -132
- package/docs/struct_Channel.js.html +127 -127
- package/docs/struct_Emote.js.html +138 -138
- package/docs/struct_EmoteFetcher.js.html +395 -399
- package/docs/struct_EmoteParser.js.html +153 -153
- package/docs/struct_FFZEmote.js.html +146 -146
- package/docs/struct_SevenTVEmote.js.html +141 -141
- package/docs/struct_TwitchEmote.js.html +130 -130
- package/docs/util_Collection.js.html +150 -150
- package/package.json +57 -57
- package/src/index.js +12 -12
- package/src/struct/BTTVEmote.js +60 -60
- package/src/struct/Channel.js +55 -55
- package/src/struct/Emote.js +66 -66
- package/src/struct/EmoteFetcher.js +323 -327
- package/src/struct/EmoteParser.js +81 -81
- package/src/struct/FFZEmote.js +74 -74
- package/src/struct/SevenTVEmote.js +69 -69
- package/src/struct/TwitchEmote.js +58 -58
- package/src/util/Collection.js +78 -78
- package/src/util/Constants.js +31 -31
- package/test/index.js +174 -174
- package/typings/index.d.ts +98 -98
|
@@ -1,150 +1,150 @@
|
|
|
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
|
-
<pre class="prettyprint source linenums"><code>/**
|
|
49
|
-
* An extended Map with utility methods.
|
|
50
|
-
* @class Collection
|
|
51
|
-
*/
|
|
52
|
-
class Collection extends Map {
|
|
53
|
-
/**
|
|
54
|
-
* Finds first matching value by property or function.
|
|
55
|
-
* Same as `Array#find`.
|
|
56
|
-
* @param {string|Function} propOrFunc - Property or function to test.
|
|
57
|
-
* @param {any} [value] - Value to find.
|
|
58
|
-
* @returns {any}
|
|
59
|
-
*/
|
|
60
|
-
find(propOrFunc, value) {
|
|
61
|
-
if (typeof propOrFunc === 'string') {
|
|
62
|
-
if (typeof value === 'undefined') return null;
|
|
63
|
-
for (const item of this.values()) {
|
|
64
|
-
if (item[propOrFunc] === value) return item;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (typeof propOrFunc === 'function') {
|
|
71
|
-
let i = 0;
|
|
72
|
-
for (const item of this.values()) {
|
|
73
|
-
if (propOrFunc(item, i, this)) return item;
|
|
74
|
-
i++;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Filters cache by function.
|
|
85
|
-
* Same as `Array#filter`.
|
|
86
|
-
* @param {Function} func - Function to test.
|
|
87
|
-
* @param {any} [thisArg] - The context for the function.
|
|
88
|
-
* @returns {Collection}
|
|
89
|
-
*/
|
|
90
|
-
filter(func, thisArg) {
|
|
91
|
-
if (thisArg) func = func.bind(thisArg);
|
|
92
|
-
|
|
93
|
-
const results = new this.constructor();
|
|
94
|
-
|
|
95
|
-
let i = 0;
|
|
96
|
-
for (const [key, item] of this) {
|
|
97
|
-
if (func(item, i, this)) results.set(key, item);
|
|
98
|
-
i++;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return results;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Maps cache by function.
|
|
106
|
-
* Same as `Array#map`.
|
|
107
|
-
* @param {Function} func - Function to use.
|
|
108
|
-
* @param {any} [thisArg] - The context for the function.
|
|
109
|
-
* @returns {any[]}
|
|
110
|
-
*/
|
|
111
|
-
map(func, thisArg) {
|
|
112
|
-
if (thisArg) func = func.bind(thisArg);
|
|
113
|
-
|
|
114
|
-
const array = new Array(this.size);
|
|
115
|
-
let i = 0;
|
|
116
|
-
for (const item of this.values()) {
|
|
117
|
-
array[i] = func(item, i, this);
|
|
118
|
-
i++;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return array;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
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>
|
|
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
|
+
<pre class="prettyprint source linenums"><code>/**
|
|
49
|
+
* An extended Map with utility methods.
|
|
50
|
+
* @class Collection
|
|
51
|
+
*/
|
|
52
|
+
class Collection extends Map {
|
|
53
|
+
/**
|
|
54
|
+
* Finds first matching value by property or function.
|
|
55
|
+
* Same as `Array#find`.
|
|
56
|
+
* @param {string|Function} propOrFunc - Property or function to test.
|
|
57
|
+
* @param {any} [value] - Value to find.
|
|
58
|
+
* @returns {any}
|
|
59
|
+
*/
|
|
60
|
+
find(propOrFunc, value) {
|
|
61
|
+
if (typeof propOrFunc === 'string') {
|
|
62
|
+
if (typeof value === 'undefined') return null;
|
|
63
|
+
for (const item of this.values()) {
|
|
64
|
+
if (item[propOrFunc] === value) return item;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeof propOrFunc === 'function') {
|
|
71
|
+
let i = 0;
|
|
72
|
+
for (const item of this.values()) {
|
|
73
|
+
if (propOrFunc(item, i, this)) return item;
|
|
74
|
+
i++;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Filters cache by function.
|
|
85
|
+
* Same as `Array#filter`.
|
|
86
|
+
* @param {Function} func - Function to test.
|
|
87
|
+
* @param {any} [thisArg] - The context for the function.
|
|
88
|
+
* @returns {Collection}
|
|
89
|
+
*/
|
|
90
|
+
filter(func, thisArg) {
|
|
91
|
+
if (thisArg) func = func.bind(thisArg);
|
|
92
|
+
|
|
93
|
+
const results = new this.constructor();
|
|
94
|
+
|
|
95
|
+
let i = 0;
|
|
96
|
+
for (const [key, item] of this) {
|
|
97
|
+
if (func(item, i, this)) results.set(key, item);
|
|
98
|
+
i++;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return results;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Maps cache by function.
|
|
106
|
+
* Same as `Array#map`.
|
|
107
|
+
* @param {Function} func - Function to use.
|
|
108
|
+
* @param {any} [thisArg] - The context for the function.
|
|
109
|
+
* @returns {any[]}
|
|
110
|
+
*/
|
|
111
|
+
map(func, thisArg) {
|
|
112
|
+
if (thisArg) func = func.bind(thisArg);
|
|
113
|
+
|
|
114
|
+
const array = new Array(this.size);
|
|
115
|
+
let i = 0;
|
|
116
|
+
for (const item of this.values()) {
|
|
117
|
+
array[i] = func(item, i, this);
|
|
118
|
+
i++;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return array;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
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>
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mkody/twitch-emoticons",
|
|
3
|
-
"version": "2.7.
|
|
4
|
-
"description": "Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"typings": "typings/index.d.ts",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"7tv",
|
|
9
|
-
"bettertwitchtv",
|
|
10
|
-
"bttv",
|
|
11
|
-
"emotes",
|
|
12
|
-
"emoticons",
|
|
13
|
-
"ffz",
|
|
14
|
-
"frankerfacez",
|
|
15
|
-
"parse",
|
|
16
|
-
"seventv",
|
|
17
|
-
"twitch-api",
|
|
18
|
-
"twitch"
|
|
19
|
-
],
|
|
20
|
-
"author": "MKody <gh@kdy.ch> (André Fernandes)",
|
|
21
|
-
"contrubutors": [
|
|
22
|
-
"1Computer",
|
|
23
|
-
"Killusions",
|
|
24
|
-
"MKody"
|
|
25
|
-
],
|
|
26
|
-
"license": "MIT",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@twurple/api": "^6.
|
|
29
|
-
"@twurple/auth": "^6.
|
|
30
|
-
"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"docdash": "^2.0.1",
|
|
34
|
-
"eslint": "^8.
|
|
35
|
-
"jsdoc": "^4.0.2"
|
|
36
|
-
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"docs": "jsdoc --configure .jsdoc.json --verbose",
|
|
39
|
-
"test": "node test/index.js",
|
|
40
|
-
"lint": "eslint ./src ./test"
|
|
41
|
-
},
|
|
42
|
-
"repository": {
|
|
43
|
-
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/mkody/twitch-emoticons.git"
|
|
45
|
-
},
|
|
46
|
-
"bugs": {
|
|
47
|
-
"url": "https://github.com/mkody/twitch-emoticons/issues"
|
|
48
|
-
},
|
|
49
|
-
"homepage": "https://github.com/mkody/twitch-emoticons",
|
|
50
|
-
"directories": {
|
|
51
|
-
"doc": "docs",
|
|
52
|
-
"test": "test"
|
|
53
|
-
},
|
|
54
|
-
"engines"
|
|
55
|
-
"node"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@mkody/twitch-emoticons",
|
|
3
|
+
"version": "2.7.1",
|
|
4
|
+
"description": "Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"typings": "typings/index.d.ts",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"7tv",
|
|
9
|
+
"bettertwitchtv",
|
|
10
|
+
"bttv",
|
|
11
|
+
"emotes",
|
|
12
|
+
"emoticons",
|
|
13
|
+
"ffz",
|
|
14
|
+
"frankerfacez",
|
|
15
|
+
"parse",
|
|
16
|
+
"seventv",
|
|
17
|
+
"twitch-api",
|
|
18
|
+
"twitch"
|
|
19
|
+
],
|
|
20
|
+
"author": "MKody <gh@kdy.ch> (André Fernandes)",
|
|
21
|
+
"contrubutors": [
|
|
22
|
+
"1Computer",
|
|
23
|
+
"Killusions",
|
|
24
|
+
"MKody"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@twurple/api": "^6.2.1",
|
|
29
|
+
"@twurple/auth": "^6.2.1",
|
|
30
|
+
"axios": "^1.4.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"docdash": "^2.0.1",
|
|
34
|
+
"eslint": "^8.41.0",
|
|
35
|
+
"jsdoc": "^4.0.2"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"docs": "jsdoc --configure .jsdoc.json --verbose",
|
|
39
|
+
"test": "node test/index.js",
|
|
40
|
+
"lint": "eslint ./src ./test"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/mkody/twitch-emoticons.git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/mkody/twitch-emoticons/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/mkody/twitch-emoticons",
|
|
50
|
+
"directories": {
|
|
51
|
+
"doc": "docs",
|
|
52
|
+
"test": "test"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=16.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
BTTVEmote: require('./struct/BTTVEmote'),
|
|
3
|
-
Channel: require('./struct/Channel'),
|
|
4
|
-
Collection: require('./util/Collection'),
|
|
5
|
-
Constants: require('./util/Constants'),
|
|
6
|
-
Emote: require('./struct/Emote'),
|
|
7
|
-
EmoteFetcher: require('./struct/EmoteFetcher'),
|
|
8
|
-
EmoteParser: require('./struct/EmoteParser'),
|
|
9
|
-
FFZEmote: require('./struct/FFZEmote'),
|
|
10
|
-
SevenTVEmote: require('./struct/SevenTVEmote'),
|
|
11
|
-
TwitchEmote: require('./struct/TwitchEmote')
|
|
12
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
BTTVEmote: require('./struct/BTTVEmote'),
|
|
3
|
+
Channel: require('./struct/Channel'),
|
|
4
|
+
Collection: require('./util/Collection'),
|
|
5
|
+
Constants: require('./util/Constants'),
|
|
6
|
+
Emote: require('./struct/Emote'),
|
|
7
|
+
EmoteFetcher: require('./struct/EmoteFetcher'),
|
|
8
|
+
EmoteParser: require('./struct/EmoteParser'),
|
|
9
|
+
FFZEmote: require('./struct/FFZEmote'),
|
|
10
|
+
SevenTVEmote: require('./struct/SevenTVEmote'),
|
|
11
|
+
TwitchEmote: require('./struct/TwitchEmote')
|
|
12
|
+
};
|
package/src/struct/BTTVEmote.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
const Emote = require('./Emote');
|
|
2
|
-
const Constants = require('../util/Constants');
|
|
3
|
-
|
|
4
|
-
/** @extends Emote */
|
|
5
|
-
class BTTVEmote extends Emote {
|
|
6
|
-
/**
|
|
7
|
-
* A BTTV emote.
|
|
8
|
-
* @param {Channel} channel - Channel this emote belongs to.
|
|
9
|
-
* @param {string} id - ID of the emote.
|
|
10
|
-
* @param {data} data - The raw emote data.
|
|
11
|
-
*/
|
|
12
|
-
constructor(channel, id, data) {
|
|
13
|
-
super(channel, id, data);
|
|
14
|
-
this.type = 'bttv';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The channel of this emote's creator.
|
|
19
|
-
* Not guaranteed to contain the emote, or be cached.
|
|
20
|
-
* @readonly
|
|
21
|
-
* @type {?Channel}
|
|
22
|
-
*/
|
|
23
|
-
get owner() {
|
|
24
|
-
return this.fetcher.channels.get(this.ownerName);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_setup(data) {
|
|
28
|
-
super._setup(data);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The name of the emote creator's channel.
|
|
32
|
-
* Will be null for global or channel emotes.
|
|
33
|
-
* @type {?string}
|
|
34
|
-
*/
|
|
35
|
-
this.ownerName = 'user' in data ? data.user.name : null;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* If emote is animated.
|
|
39
|
-
* @type {boolean}
|
|
40
|
-
*/
|
|
41
|
-
this.animated = data.animated;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The image type of the emote.
|
|
45
|
-
* @type {string}
|
|
46
|
-
*/
|
|
47
|
-
this.imageType = 'webp';
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Gets the image link of the emote.
|
|
52
|
-
* @param {number} size - The size of the image, 0, 1, or 2.
|
|
53
|
-
* @returns {string}
|
|
54
|
-
*/
|
|
55
|
-
toLink(size = 0) {
|
|
56
|
-
return Constants.BTTV.CDN(this.id, size); // eslint-disable-line new-cap
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = BTTVEmote;
|
|
1
|
+
const Emote = require('./Emote');
|
|
2
|
+
const Constants = require('../util/Constants');
|
|
3
|
+
|
|
4
|
+
/** @extends Emote */
|
|
5
|
+
class BTTVEmote extends Emote {
|
|
6
|
+
/**
|
|
7
|
+
* A BTTV emote.
|
|
8
|
+
* @param {Channel} channel - Channel this emote belongs to.
|
|
9
|
+
* @param {string} id - ID of the emote.
|
|
10
|
+
* @param {data} data - The raw emote data.
|
|
11
|
+
*/
|
|
12
|
+
constructor(channel, id, data) {
|
|
13
|
+
super(channel, id, data);
|
|
14
|
+
this.type = 'bttv';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The channel of this emote's creator.
|
|
19
|
+
* Not guaranteed to contain the emote, or be cached.
|
|
20
|
+
* @readonly
|
|
21
|
+
* @type {?Channel}
|
|
22
|
+
*/
|
|
23
|
+
get owner() {
|
|
24
|
+
return this.fetcher.channels.get(this.ownerName);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_setup(data) {
|
|
28
|
+
super._setup(data);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The name of the emote creator's channel.
|
|
32
|
+
* Will be null for global or channel emotes.
|
|
33
|
+
* @type {?string}
|
|
34
|
+
*/
|
|
35
|
+
this.ownerName = 'user' in data ? data.user.name : null;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* If emote is animated.
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
*/
|
|
41
|
+
this.animated = data.animated;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The image type of the emote.
|
|
45
|
+
* @type {string}
|
|
46
|
+
*/
|
|
47
|
+
this.imageType = 'webp';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gets the image link of the emote.
|
|
52
|
+
* @param {number} size - The size of the image, 0, 1, or 2.
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
toLink(size = 0) {
|
|
56
|
+
return Constants.BTTV.CDN(this.id, size); // eslint-disable-line new-cap
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = BTTVEmote;
|