@mkody/twitch-emoticons 2.7.0 → 2.8.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/.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 +36 -4
- package/docs/BTTVEmote.html +1641 -1319
- package/docs/Channel.html +823 -823
- package/docs/Collection.html +797 -797
- package/docs/Emote.html +906 -801
- package/docs/EmoteFetcher.html +3680 -2946
- package/docs/EmoteParser.html +811 -811
- package/docs/FFZEmote.html +1795 -1473
- package/docs/SevenTV.html +1190 -1190
- package/docs/SevenTVEmote.html +1705 -1395
- package/docs/TwitchEmote.html +1637 -1315
- package/docs/index.html +230 -206
- package/docs/struct_BTTVEmote.js.html +162 -132
- package/docs/struct_Channel.js.html +127 -127
- package/docs/struct_Emote.js.html +151 -138
- package/docs/struct_EmoteFetcher.js.html +427 -399
- package/docs/struct_EmoteParser.js.html +153 -153
- package/docs/struct_FFZEmote.js.html +185 -146
- package/docs/struct_SevenTVEmote.js.html +178 -141
- package/docs/struct_TwitchEmote.js.html +159 -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 +90 -60
- package/src/struct/Channel.js +55 -55
- package/src/struct/Emote.js +79 -66
- package/src/struct/EmoteFetcher.js +355 -327
- package/src/struct/EmoteParser.js +81 -81
- package/src/struct/EmoteTypeMapper.js +13 -0
- package/src/struct/FFZEmote.js +113 -74
- package/src/struct/SevenTVEmote.js +106 -69
- package/src/struct/TwitchEmote.js +87 -58
- package/src/util/Collection.js +78 -78
- package/src/util/Constants.js +31 -31
- package/test/index.js +482 -174
- package/typings/index.d.ts +115 -98
package/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 1Computer1
|
|
4
|
-
Copyright (c) 2019 André "Kody" Fernandes
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 1Computer1
|
|
4
|
+
Copyright (c) 2019 André "Kody" Fernandes
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -49,6 +49,18 @@ fetcher.fetchTwitchEmotes(null).then(() => {
|
|
|
49
49
|
});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
#### Bring your own `@twurple/api`
|
|
53
|
+
|
|
54
|
+
If you already use [Twurple](https://twurple.js.org/) in your project and manage authentification
|
|
55
|
+
(i.e. with user tokens), you can reuse it in this project by skipping the first two paramters and
|
|
56
|
+
setting `apiClient` with your [ApiClient](https://twurple.js.org/reference/api/classes/ApiClient.html) object.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
const fetcher = new EmoteFetcher(null, null, {
|
|
60
|
+
apiClient: yourOwnTwurpleApiClientHere
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
52
64
|
#### All providers, global + channel, custom template and match pattern
|
|
53
65
|
|
|
54
66
|
```js
|
|
@@ -110,16 +122,36 @@ const { EmoteFetcher } = require('@mkody/twitch-emoticons');
|
|
|
110
122
|
const fetcher = new EmoteFetcher();
|
|
111
123
|
|
|
112
124
|
// Fetch global emotes in AVIF (channel id has to be `null` for global)
|
|
113
|
-
fetcher.fetchSevenTVEmotes(null, 'avif');
|
|
125
|
+
await fetcher.fetchSevenTVEmotes(null, 'avif');
|
|
114
126
|
|
|
115
127
|
// Fetch 0kody's emotes with the package's default format (WEBP)
|
|
116
|
-
fetcher.fetchSevenTVEmotes(44317909);
|
|
128
|
+
await fetcher.fetchSevenTVEmotes(44317909);
|
|
117
129
|
|
|
118
130
|
// ... which is currently the same as
|
|
119
|
-
fetcher.fetchSevenTVEmotes(44317909, 'webp');
|
|
131
|
+
await fetcher.fetchSevenTVEmotes(44317909, 'webp');
|
|
120
132
|
|
|
121
133
|
// Fetch Anatole's emotes in AVIF
|
|
122
|
-
fetcher.fetchSevenTVEmotes(24377667, 'avif');
|
|
134
|
+
await fetcher.fetchSevenTVEmotes(24377667, 'avif');
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Export and import emote data
|
|
138
|
+
|
|
139
|
+
This can be useful to save the emotes in a cache or for offline content.
|
|
140
|
+
(For offline content, you'll still need to download emotes and proxy their URLs.)
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
const { EmoteFetcher } = require('@mkody/twitch-emoticons');
|
|
144
|
+
const fetcher = new EmoteFetcher();
|
|
145
|
+
|
|
146
|
+
// First fetch some emotes
|
|
147
|
+
await fetcher.fetchSevenTVEmotes(null, 'avif');
|
|
148
|
+
|
|
149
|
+
// Then you can use .toObject() on an `Emote` to export its data.
|
|
150
|
+
// Here's a map to get them all in a single array.
|
|
151
|
+
const emotes = fetcher.emotes.map(emote => emote.toObject());
|
|
152
|
+
|
|
153
|
+
// Later, with or without a fresh `EmoteFetcher`, you can use .fromObject() on the fetcher.
|
|
154
|
+
fetcher.fromObject(emotes);
|
|
123
155
|
```
|
|
124
156
|
|
|
125
157
|
### Links
|