@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
package/src/struct/Channel.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
const Collection = require('../util/Collection');
|
|
2
|
-
|
|
3
|
-
class Channel {
|
|
4
|
-
/**
|
|
5
|
-
* A Twitch channel.
|
|
6
|
-
* @param {EmoteFetcher} fetcher - The emote fetcher.
|
|
7
|
-
* @param {int} id - ID of the channel.
|
|
8
|
-
*/
|
|
9
|
-
constructor(fetcher, id) {
|
|
10
|
-
/**
|
|
11
|
-
* The emote fetcher.
|
|
12
|
-
* @type {EmoteFetcher}
|
|
13
|
-
*/
|
|
14
|
-
this.fetcher = fetcher;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The ID of this channel.
|
|
18
|
-
* For the global channel, the ID will be null.
|
|
19
|
-
* @type {?int}
|
|
20
|
-
*/
|
|
21
|
-
this.channel_id = id;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Cached emotes belonging to this channel.
|
|
25
|
-
* @type {Collection<string, Emote>}
|
|
26
|
-
*/
|
|
27
|
-
this.emotes = new Collection();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Fetches the BTTV emotes for this channel.
|
|
32
|
-
* @returns {Promise<Collection<string, BTTVEmote>>}
|
|
33
|
-
*/
|
|
34
|
-
fetchBTTVEmotes() {
|
|
35
|
-
return this.fetcher.fetchBTTVEmotes(this.id);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Fetches the FFZ emotes for this channel.
|
|
40
|
-
* @returns {Promise<Collection<string, FFZEmote>>}
|
|
41
|
-
*/
|
|
42
|
-
fetchFFZEmotes() {
|
|
43
|
-
return this.fetcher.fetchFFZEmotes(this.id);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Fetches the 7TV emotes for this channel.
|
|
48
|
-
* @returns {Promise<Collection<string, SevenTVEmote>>}
|
|
49
|
-
*/
|
|
50
|
-
fetchSevenTVEmotes() {
|
|
51
|
-
return this.fetcher.fetchSevenTVEmotes(this.id);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = Channel;
|
|
1
|
+
const Collection = require('../util/Collection');
|
|
2
|
+
|
|
3
|
+
class Channel {
|
|
4
|
+
/**
|
|
5
|
+
* A Twitch channel.
|
|
6
|
+
* @param {EmoteFetcher} fetcher - The emote fetcher.
|
|
7
|
+
* @param {int} id - ID of the channel.
|
|
8
|
+
*/
|
|
9
|
+
constructor(fetcher, id) {
|
|
10
|
+
/**
|
|
11
|
+
* The emote fetcher.
|
|
12
|
+
* @type {EmoteFetcher}
|
|
13
|
+
*/
|
|
14
|
+
this.fetcher = fetcher;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The ID of this channel.
|
|
18
|
+
* For the global channel, the ID will be null.
|
|
19
|
+
* @type {?int}
|
|
20
|
+
*/
|
|
21
|
+
this.channel_id = id;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Cached emotes belonging to this channel.
|
|
25
|
+
* @type {Collection<string, Emote>}
|
|
26
|
+
*/
|
|
27
|
+
this.emotes = new Collection();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Fetches the BTTV emotes for this channel.
|
|
32
|
+
* @returns {Promise<Collection<string, BTTVEmote>>}
|
|
33
|
+
*/
|
|
34
|
+
fetchBTTVEmotes() {
|
|
35
|
+
return this.fetcher.fetchBTTVEmotes(this.id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Fetches the FFZ emotes for this channel.
|
|
40
|
+
* @returns {Promise<Collection<string, FFZEmote>>}
|
|
41
|
+
*/
|
|
42
|
+
fetchFFZEmotes() {
|
|
43
|
+
return this.fetcher.fetchFFZEmotes(this.id);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Fetches the 7TV emotes for this channel.
|
|
48
|
+
* @returns {Promise<Collection<string, SevenTVEmote>>}
|
|
49
|
+
*/
|
|
50
|
+
fetchSevenTVEmotes() {
|
|
51
|
+
return this.fetcher.fetchSevenTVEmotes(this.id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = Channel;
|
package/src/struct/Emote.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
class Emote {
|
|
2
|
-
/**
|
|
3
|
-
* Base class for emotes.
|
|
4
|
-
* This constructor is not to be used.
|
|
5
|
-
* @param {Channel} channel - Channel this emote belongs to.
|
|
6
|
-
* @param {string} id - ID of the emote.
|
|
7
|
-
* @param {data} data - The raw emote data.
|
|
8
|
-
*/
|
|
9
|
-
constructor(channel, id, data) {
|
|
10
|
-
if (new.target.name === Emote.name) {
|
|
11
|
-
throw new Error('Base Emote class cannot be used');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The emote fetcher.
|
|
16
|
-
* @type {EmoteFetcher}
|
|
17
|
-
*/
|
|
18
|
-
this.fetcher = channel.fetcher;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The channel this emote belongs to.
|
|
22
|
-
* Only accurate and constant on Twitch emotes.
|
|
23
|
-
* For other types of emotes, use the `owner` or `ownerName` property.
|
|
24
|
-
* @type {Channel}
|
|
25
|
-
*/
|
|
26
|
-
this.channel = channel;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The ID of this emote.
|
|
30
|
-
* @type {string}
|
|
31
|
-
*/
|
|
32
|
-
this.id = id;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The type of this emote.
|
|
36
|
-
* Either `twitch`, `bttv`, `ffz`, or '7tv'.
|
|
37
|
-
* @type {string}
|
|
38
|
-
*/
|
|
39
|
-
this.type = null;
|
|
40
|
-
|
|
41
|
-
this._setup(data);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
_setup(data) {
|
|
45
|
-
/**
|
|
46
|
-
* The code or name of the emote.
|
|
47
|
-
* @type {string}
|
|
48
|
-
*/
|
|
49
|
-
this.code = data.code;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
toLink() {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Override for `toString`.
|
|
58
|
-
* Will give the emote's name.
|
|
59
|
-
* @returns {string}
|
|
60
|
-
*/
|
|
61
|
-
toString() {
|
|
62
|
-
return this.code;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports = Emote;
|
|
1
|
+
class Emote {
|
|
2
|
+
/**
|
|
3
|
+
* Base class for emotes.
|
|
4
|
+
* This constructor is not to be used.
|
|
5
|
+
* @param {Channel} channel - Channel this emote belongs to.
|
|
6
|
+
* @param {string} id - ID of the emote.
|
|
7
|
+
* @param {data} data - The raw emote data.
|
|
8
|
+
*/
|
|
9
|
+
constructor(channel, id, data) {
|
|
10
|
+
if (new.target.name === Emote.name) {
|
|
11
|
+
throw new Error('Base Emote class cannot be used');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The emote fetcher.
|
|
16
|
+
* @type {EmoteFetcher}
|
|
17
|
+
*/
|
|
18
|
+
this.fetcher = channel.fetcher;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The channel this emote belongs to.
|
|
22
|
+
* Only accurate and constant on Twitch emotes.
|
|
23
|
+
* For other types of emotes, use the `owner` or `ownerName` property.
|
|
24
|
+
* @type {Channel}
|
|
25
|
+
*/
|
|
26
|
+
this.channel = channel;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The ID of this emote.
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
this.id = id;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The type of this emote.
|
|
36
|
+
* Either `twitch`, `bttv`, `ffz`, or '7tv'.
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
39
|
+
this.type = null;
|
|
40
|
+
|
|
41
|
+
this._setup(data);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_setup(data) {
|
|
45
|
+
/**
|
|
46
|
+
* The code or name of the emote.
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
this.code = data.code;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
toLink() {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Override for `toString`.
|
|
58
|
+
* Will give the emote's name.
|
|
59
|
+
* @returns {string}
|
|
60
|
+
*/
|
|
61
|
+
toString() {
|
|
62
|
+
return this.code;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = Emote;
|