@mkody/twitch-emoticons 2.9.6 → 3.0.0-beta.2
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 +530 -169
- package/dist/TwitchEmoticons.cjs +950 -0
- package/dist/TwitchEmoticons.esm.min.js +7 -0
- package/dist/TwitchEmoticons.esm.min.js.map +7 -0
- package/dist/TwitchEmoticons.min.js +2 -20
- package/dist/TwitchEmoticons.min.js.map +4 -4
- package/package.json +99 -72
- package/src/index.js +38 -12
- package/src/struct/BTTVEmote.js +72 -74
- package/src/struct/Channel.js +48 -48
- package/src/struct/Emote.js +71 -71
- package/src/struct/EmoteFetcher.js +358 -322
- package/src/struct/EmoteParser.js +95 -84
- package/src/struct/EmoteTypeMapper.js +9 -9
- package/src/struct/FFZEmote.js +91 -93
- package/src/struct/SevenTVEmote.js +88 -90
- package/src/struct/TwitchEmote.js +72 -71
- package/src/util/Collection.js +69 -55
- package/src/util/Constants.js +30 -30
- package/typings/index.d.cts +254 -0
- package/typings/index.d.ts +216 -99
- package/.jsdoc.json +0 -46
- package/.nvmrc +0 -1
- package/docs/BTTVEmote.html +0 -1532
- package/docs/Channel.html +0 -824
- package/docs/Collection.html +0 -798
- package/docs/Emote.html +0 -832
- package/docs/EmoteFetcher.html +0 -3741
- package/docs/EmoteParser.html +0 -1187
- package/docs/FFZEmote.html +0 -1686
- package/docs/SevenTVEmote.html +0 -1596
- package/docs/TwitchEmote.html +0 -1528
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/index.html +0 -233
- package/docs/scripts/collapse.js +0 -39
- package/docs/scripts/commonNav.js +0 -28
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/nav.js +0 -12
- package/docs/scripts/polyfill.js +0 -4
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/scripts/search.js +0 -99
- package/docs/struct_BTTVEmote.js.html +0 -162
- package/docs/struct_Channel.js.html +0 -132
- package/docs/struct_Emote.js.html +0 -159
- package/docs/struct_EmoteFetcher.js.html +0 -429
- package/docs/struct_EmoteParser.js.html +0 -172
- package/docs/struct_FFZEmote.js.html +0 -185
- package/docs/struct_SevenTVEmote.js.html +0 -180
- package/docs/struct_TwitchEmote.js.html +0 -159
- package/docs/styles/jsdoc.css +0 -776
- package/docs/styles/prettify.css +0 -80
- package/docs/util_Collection.js.html +0 -151
- package/eslint.config.mjs +0 -215
- package/jest.config.js +0 -198
- package/test/BTTV.test.js +0 -48
- package/test/FFZ.test.js +0 -71
- package/test/SevenTV.test.js +0 -71
- package/test/ToFromObject.test.js +0 -156
- package/test/Twitch.test.js +0 -64
- package/test/__snapshots__/ToFromObject.test.js.snap +0 -121
- package/test/other.test.js +0 -72
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Emote from './Emote.js'
|
|
2
|
+
import Constants from '../util/Constants.js'
|
|
3
3
|
|
|
4
4
|
/** @augments Emote */
|
|
5
5
|
class TwitchEmote extends Emote {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The channel of this emote's creator.
|
|
19
|
-
* @readonly
|
|
20
|
-
* @type {Channel}
|
|
21
|
-
*/
|
|
22
|
-
get owner() {
|
|
23
|
-
return this.channel;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
_setup(data) {
|
|
27
|
-
super._setup(data);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The set ID of the emote.
|
|
31
|
-
* @type {?string}
|
|
32
|
-
*/
|
|
33
|
-
this.set = data.emoticon_set;
|
|
6
|
+
/**
|
|
7
|
+
* A Twitch 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 = 'twitch'
|
|
15
|
+
}
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* @type {boolean}
|
|
38
|
-
*/
|
|
39
|
-
this.animated = 'animated' in data.formats;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The image type of the emote.
|
|
43
|
-
* @type {string}
|
|
44
|
-
*/
|
|
45
|
-
this.imageType = 'animated' in data.formats ? 'gif' : 'png';
|
|
46
|
-
}
|
|
17
|
+
_setup (data) {
|
|
18
|
+
super._setup(data)
|
|
47
19
|
|
|
48
20
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
51
|
-
* @returns {string}
|
|
21
|
+
* The set ID of the emote.
|
|
22
|
+
* @type {?string}
|
|
52
23
|
*/
|
|
53
|
-
|
|
54
|
-
return Constants.Twitch.CDN(this.id, size); // eslint-disable-line new-cap
|
|
55
|
-
}
|
|
24
|
+
this.set = data.emoticon_set
|
|
56
25
|
|
|
57
26
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @returns {object}
|
|
27
|
+
* If emote is animated.
|
|
28
|
+
* @type {boolean}
|
|
61
29
|
*/
|
|
62
|
-
|
|
63
|
-
return Object.assign({}, super.toObject(), {
|
|
64
|
-
animated: this.animated,
|
|
65
|
-
set: this.set,
|
|
66
|
-
type: this.type
|
|
67
|
-
});
|
|
68
|
-
}
|
|
30
|
+
this.animated = 'animated' in data.formats
|
|
69
31
|
|
|
70
32
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
73
|
-
* @param {Channel} [channel=null] - Channel this emote belongs to.
|
|
74
|
-
* @returns {TwitchEmote}
|
|
33
|
+
* The image type of the emote.
|
|
34
|
+
* @type {string}
|
|
75
35
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
36
|
+
this.imageType = 'animated' in data.formats ? 'gif' : 'png'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Gets the image link of the emote.
|
|
41
|
+
* @param {object} [options] - Options for the link.
|
|
42
|
+
* @param {number} [options.size=0] - Size (scale) for the emote.
|
|
43
|
+
* @param {boolean} [options.forceStatic] - Whether to force the emote to be static (non-animated). Defaults to the fetcher's forceStatic or `false`.
|
|
44
|
+
* @param {'dark' | 'light'} [options.themeMode] - Only for Twitch: the preferred theme mode. Defaults to the fetcher's twitchThemeMode or `dark`.
|
|
45
|
+
* @returns {string} - The URL to the emote.
|
|
46
|
+
*/
|
|
47
|
+
toLink (options) {
|
|
48
|
+
const {
|
|
49
|
+
size = 0,
|
|
50
|
+
forceStatic = this.fetcher.forceStatic || false,
|
|
51
|
+
themeMode = this.fetcher.twitchThemeMode || 'dark',
|
|
52
|
+
} = options || {}
|
|
53
|
+
|
|
54
|
+
return Constants.Twitch.CDN(this.id, size, forceStatic, themeMode)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Override for `toObject`.
|
|
59
|
+
* Will result in an Object representation of a TwitchEmote
|
|
60
|
+
* @returns {object} - Object representation of the TwitchEmote.
|
|
61
|
+
*/
|
|
62
|
+
toObject () {
|
|
63
|
+
return {
|
|
64
|
+
...super.toObject(),
|
|
65
|
+
animated: this.animated,
|
|
66
|
+
set: this.set,
|
|
67
|
+
type: this.type,
|
|
84
68
|
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Converts an emote Object into a TwitchEmote
|
|
73
|
+
* @param {object} [emoteObject] - Object representation of this emote
|
|
74
|
+
* @param {Channel} [channel] - Channel this emote belongs to.
|
|
75
|
+
* @returns {TwitchEmote} - A TwitchEmote instance.
|
|
76
|
+
*/
|
|
77
|
+
static fromObject (emoteObject, channel) {
|
|
78
|
+
return new TwitchEmote(channel, emoteObject.id,
|
|
79
|
+
{
|
|
80
|
+
code: emoteObject.code,
|
|
81
|
+
animated: emoteObject.animated,
|
|
82
|
+
emoticon_set: emoteObject.set,
|
|
83
|
+
formats: emoteObject.animated ? { animated: emoteObject.animated } : {},
|
|
84
|
+
})
|
|
85
|
+
}
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
export default TwitchEmote
|
package/src/util/Collection.js
CHANGED
|
@@ -4,76 +4,90 @@
|
|
|
4
4
|
* @class Collection
|
|
5
5
|
*/
|
|
6
6
|
class Collection extends Map {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* Finds first matching value by property or function.
|
|
9
|
+
* Same as `Array#find`.
|
|
10
|
+
* @param {string|Function} propOrFunc - Property or function to test.
|
|
11
|
+
* @param {any} [value] - Value to find.
|
|
12
|
+
* @returns {any|null} - The found item or null if none found.
|
|
13
|
+
*/
|
|
14
|
+
find (propOrFunc, value) {
|
|
15
|
+
if (typeof propOrFunc === 'string') {
|
|
16
|
+
if (value === undefined) {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
for (const item of this.values()) {
|
|
21
|
+
if (item[propOrFunc] === value) {
|
|
22
|
+
return item
|
|
22
23
|
}
|
|
24
|
+
}
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
for (const item of this.values()) {
|
|
27
|
-
if (propOrFunc(item, i, this)) return item;
|
|
28
|
-
i++;
|
|
29
|
-
}
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
if (typeof propOrFunc === 'function') {
|
|
30
|
+
let i = 0
|
|
31
|
+
for (const item of this.values()) {
|
|
32
|
+
if (propOrFunc(item, i, this)) {
|
|
33
|
+
return item
|
|
32
34
|
}
|
|
35
|
+
i++
|
|
36
|
+
}
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
return null
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* Same as `Array#filter`.
|
|
40
|
-
* @param {Function} func - Function to test.
|
|
41
|
-
* @param {any} [thisArg] - The context for the function.
|
|
42
|
-
* @returns {Collection}
|
|
43
|
-
*/
|
|
44
|
-
filter(func, thisArg) {
|
|
45
|
-
if (thisArg) func = func.bind(thisArg);
|
|
41
|
+
return null
|
|
42
|
+
}
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Filters cache by function.
|
|
46
|
+
* Same as `Array#filter`.
|
|
47
|
+
* @param {Function} func - Function to test.
|
|
48
|
+
* @param {any} [thisArg] - The context for the function.
|
|
49
|
+
* @returns {Collection} - A new collection with the filtered items.
|
|
50
|
+
*/
|
|
51
|
+
filter (func, thisArg) {
|
|
52
|
+
if (thisArg) {
|
|
53
|
+
func = func.bind(thisArg)
|
|
54
|
+
}
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
for (const [key, item] of this) {
|
|
51
|
-
if (func(item, i, this)) results.set(key, item);
|
|
52
|
-
i++;
|
|
53
|
-
}
|
|
56
|
+
const results = new this.constructor()
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
let i = 0
|
|
59
|
+
for (const [key, item] of this) {
|
|
60
|
+
if (func(item, i, this)) {
|
|
61
|
+
results.set(key, item)
|
|
62
|
+
}
|
|
63
|
+
i++
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
* Same as `Array#map`.
|
|
61
|
-
* @param {Function} func - Function to use.
|
|
62
|
-
* @param {any} [thisArg] - The context for the function.
|
|
63
|
-
* @returns {any[]}
|
|
64
|
-
*/
|
|
65
|
-
map(func, thisArg) {
|
|
66
|
-
if (thisArg) func = func.bind(thisArg);
|
|
66
|
+
return results
|
|
67
|
+
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Maps cache by function.
|
|
71
|
+
* Same as `Array#map`.
|
|
72
|
+
* @param {Function} func - Function to use.
|
|
73
|
+
* @param {any} [thisArg] - The context for the function.
|
|
74
|
+
* @returns {any[]} - An array with the mapped items.
|
|
75
|
+
*/
|
|
76
|
+
map (func, thisArg) {
|
|
77
|
+
if (thisArg) {
|
|
78
|
+
func = func.bind(thisArg)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const array = new Array(this.size)
|
|
74
82
|
|
|
75
|
-
|
|
83
|
+
let i = 0
|
|
84
|
+
for (const item of this.values()) {
|
|
85
|
+
array[i] = func(item, i, this)
|
|
86
|
+
i++
|
|
76
87
|
}
|
|
88
|
+
|
|
89
|
+
return array
|
|
90
|
+
}
|
|
77
91
|
}
|
|
78
92
|
|
|
79
|
-
|
|
93
|
+
export default Collection
|
package/src/util/Constants.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default {
|
|
2
|
+
Twitch: {
|
|
3
|
+
CDN: (id, size = 0, forceStatic = false, theme = 'dark') => `https://static-cdn.jtvnw.net/emoticons/v2/${id}/${forceStatic ? 'static' : 'default'}/${theme}/${size + 1}.0`,
|
|
4
|
+
},
|
|
5
|
+
BTTV: {
|
|
6
|
+
Global: 'https://api.betterttv.net/3/cached/emotes/global',
|
|
7
|
+
Channel: (id) => `https://api.betterttv.net/3/cached/users/twitch/${id}`,
|
|
8
|
+
CDN: (id, size = 0, forceStatic = false) => `https://cdn.betterttv.net/emote/${id}/${size + 1}x.${forceStatic ? 'png' : 'webp'}`,
|
|
9
|
+
},
|
|
10
|
+
SevenTV: {
|
|
11
|
+
Global: 'https://7tv.io/v3/emote-sets/global',
|
|
12
|
+
Channel: (id) => `https://7tv.io/v3/users/twitch/${id}`,
|
|
13
|
+
CDN: (id, format, size = 1, forceStatic = false) => `https://cdn.7tv.app/emote/${id}/${size}x${forceStatic ? '_static' : ''}.${format}`,
|
|
14
|
+
},
|
|
15
|
+
FFZ: {
|
|
16
|
+
sets: {
|
|
17
|
+
Global: 3,
|
|
18
|
+
Modifiers: 1532818,
|
|
4
19
|
},
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Global: 3,
|
|
18
|
-
Modifiers: 1532818
|
|
19
|
-
},
|
|
20
|
-
Set: id => `https://api.frankerfacez.com/v1/set/${id}`,
|
|
21
|
-
Channel: id => `https://api.frankerfacez.com/v1/room/id/${id}`,
|
|
22
|
-
CDN: (id, size) => `https://cdn.frankerfacez.com/emote/${id}/${size}`,
|
|
23
|
-
CDNAnimated: (id, size) => `https://cdn.frankerfacez.com/emote/${id}/animated/${size}.webp`
|
|
24
|
-
},
|
|
25
|
-
Templates: {
|
|
26
|
-
html: '<img alt="{name}" title="{name}" class="twitch-emote twitch-emote-{size}" src="{link}">',
|
|
27
|
-
markdown: '',
|
|
28
|
-
bbcode: '[img]{link}[/img]',
|
|
29
|
-
plain: '{link}'
|
|
30
|
-
}
|
|
31
|
-
};
|
|
20
|
+
Set: (id) => `https://api.frankerfacez.com/v1/set/${id}`,
|
|
21
|
+
Channel: (id) => `https://api.frankerfacez.com/v1/room/id/${id}`,
|
|
22
|
+
CDN: (id, size = 1) => `https://cdn.frankerfacez.com/emote/${id}/${size}`,
|
|
23
|
+
CDNAnimated: (id, size = 1) => `https://cdn.frankerfacez.com/emote/${id}/animated/${size}.webp`,
|
|
24
|
+
},
|
|
25
|
+
Templates: {
|
|
26
|
+
html: '<img alt="{name}" title="{name}" class="twitch-emote" src="{link}">',
|
|
27
|
+
markdown: '',
|
|
28
|
+
bbcode: '[img]{link}[/img]',
|
|
29
|
+
plain: '{link}',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
declare class Channel {
|
|
2
|
+
public constructor (
|
|
3
|
+
fetcher: EmoteFetcher,
|
|
4
|
+
id: number
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
public fetcher: EmoteFetcher
|
|
8
|
+
public id: number
|
|
9
|
+
public emotes: Collection<string, Emote>
|
|
10
|
+
|
|
11
|
+
public fetchBTTVEmotes (): Promise<Collection<string, BTTVEmote>>
|
|
12
|
+
|
|
13
|
+
public fetchFFZEmotes (): Promise<Collection<string, FFZEmote>>
|
|
14
|
+
|
|
15
|
+
public fetchSevenTVEmotes (): Promise<Collection<string, SevenTVEmote>>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare abstract class Emote {
|
|
19
|
+
public constructor (
|
|
20
|
+
channel: Channel,
|
|
21
|
+
id: string,
|
|
22
|
+
data: object
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
public fetcher: EmoteFetcher
|
|
26
|
+
public channel: Channel
|
|
27
|
+
public id: string
|
|
28
|
+
public type: 'twitch' | 'bttv' | 'ffz' | '7tv' | null
|
|
29
|
+
public code: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class EmoteFetcher {
|
|
33
|
+
public constructor (
|
|
34
|
+
options?: {
|
|
35
|
+
twitchAppID?: string,
|
|
36
|
+
twitchAppSecret?: string,
|
|
37
|
+
apiClient?: object,
|
|
38
|
+
forceStatic?: boolean,
|
|
39
|
+
twitchThemeMode?: 'dark' | 'light'
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
public emotes: Collection<string, Emote>
|
|
44
|
+
public channels: Collection<string, Channel>
|
|
45
|
+
public forceStatic: boolean
|
|
46
|
+
public twitchThemeMode: 'dark' | 'light'
|
|
47
|
+
|
|
48
|
+
public fetchTwitchEmotes (
|
|
49
|
+
id?: number
|
|
50
|
+
): Promise<Collection<string, TwitchEmote>>
|
|
51
|
+
|
|
52
|
+
public fetchBTTVEmotes (
|
|
53
|
+
id?: number
|
|
54
|
+
): Promise<Collection<string, BTTVEmote>>
|
|
55
|
+
|
|
56
|
+
public fetchFFZEmotes (
|
|
57
|
+
id?: number
|
|
58
|
+
): Promise<Collection<string, FFZEmote>>
|
|
59
|
+
|
|
60
|
+
public fetchSevenTVEmotes (
|
|
61
|
+
id?: number,
|
|
62
|
+
options?: {
|
|
63
|
+
format?: 'webp' | 'avif'
|
|
64
|
+
}
|
|
65
|
+
): Promise<Collection<string, SevenTVEmote>>
|
|
66
|
+
|
|
67
|
+
public fromObject (
|
|
68
|
+
emotesArray: EmoteObject[]
|
|
69
|
+
): Emote[]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
declare class EmoteParser {
|
|
73
|
+
public constructor (
|
|
74
|
+
fetcher: EmoteFetcher,
|
|
75
|
+
options?: {
|
|
76
|
+
template?: string,
|
|
77
|
+
type?: 'html' | 'markdown' | 'bbcode' | 'plain',
|
|
78
|
+
match?: RegExp
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
public parse (
|
|
83
|
+
text: string,
|
|
84
|
+
options?: {
|
|
85
|
+
size?: number,
|
|
86
|
+
forceStatic?: boolean,
|
|
87
|
+
themeMode?: 'dark' | 'light'
|
|
88
|
+
}
|
|
89
|
+
): string
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare class TwitchEmote extends Emote {
|
|
93
|
+
public constructor (
|
|
94
|
+
channel: Channel,
|
|
95
|
+
id: string,
|
|
96
|
+
data: object
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
public set?: string;
|
|
100
|
+
public animated: boolean
|
|
101
|
+
public imageType: 'png' | 'gif'
|
|
102
|
+
public readonly owner: Channel
|
|
103
|
+
|
|
104
|
+
public toLink (
|
|
105
|
+
options?: {
|
|
106
|
+
size: number,
|
|
107
|
+
forceStatic?: boolean,
|
|
108
|
+
themeMode?: 'dark' | 'light'
|
|
109
|
+
}
|
|
110
|
+
): string
|
|
111
|
+
|
|
112
|
+
public toObject (): EmoteObject
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare class BTTVEmote extends Emote {
|
|
116
|
+
public constructor (
|
|
117
|
+
channel: Channel,
|
|
118
|
+
id: string,
|
|
119
|
+
data: any
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
public ownerName: string | null
|
|
123
|
+
public animated: boolean
|
|
124
|
+
public imageType: 'webp'
|
|
125
|
+
public readonly owner?: Channel
|
|
126
|
+
|
|
127
|
+
public toLink (
|
|
128
|
+
options?: {
|
|
129
|
+
size: number,
|
|
130
|
+
forceStatic?: boolean
|
|
131
|
+
}
|
|
132
|
+
): string
|
|
133
|
+
|
|
134
|
+
public toObject (): EmoteObject
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class FFZEmote extends Emote {
|
|
138
|
+
public constructor (
|
|
139
|
+
channel: Channel,
|
|
140
|
+
id: string,
|
|
141
|
+
data: object
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
public ownerName: string | null
|
|
145
|
+
public sizes: string[]
|
|
146
|
+
public animated: boolean
|
|
147
|
+
public imageType: 'png' | 'webp'
|
|
148
|
+
public modifier: boolean
|
|
149
|
+
public readonly owner?: Channel
|
|
150
|
+
|
|
151
|
+
public toLink (
|
|
152
|
+
options?: {
|
|
153
|
+
size: number,
|
|
154
|
+
forceStatic?: boolean
|
|
155
|
+
}
|
|
156
|
+
): string
|
|
157
|
+
|
|
158
|
+
public toObject (): EmoteObject
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare class SevenTVEmote extends Emote {
|
|
162
|
+
public constructor (
|
|
163
|
+
channel: Channel,
|
|
164
|
+
id: string,
|
|
165
|
+
data: object
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
public ownerName: string | null
|
|
169
|
+
public sizes: string[]
|
|
170
|
+
public animated: boolean
|
|
171
|
+
public imageType: 'webp' | 'avif'
|
|
172
|
+
public readonly owner?: Channel
|
|
173
|
+
|
|
174
|
+
public toLink (
|
|
175
|
+
options?: {
|
|
176
|
+
size: number,
|
|
177
|
+
forceStatic?: boolean
|
|
178
|
+
}
|
|
179
|
+
): string
|
|
180
|
+
|
|
181
|
+
public toObject (): EmoteObject
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface EmoteObject {
|
|
185
|
+
code: string,
|
|
186
|
+
id: string,
|
|
187
|
+
channel_id: string | null,
|
|
188
|
+
type: 'twitch' | 'bttv' | 'ffz' | '7tv' | null,
|
|
189
|
+
animated?: boolean,
|
|
190
|
+
ownerName?: string,
|
|
191
|
+
sizes?: string[],
|
|
192
|
+
set?: string,
|
|
193
|
+
imageType?: string
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare const Constants: {
|
|
197
|
+
Twitch: {
|
|
198
|
+
CDN: (id: string, size?: number, forceStatic?: boolean, theme?: 'dark' | 'light') => string;
|
|
199
|
+
};
|
|
200
|
+
BTTV: {
|
|
201
|
+
Global: string;
|
|
202
|
+
Channel: (id: string) => string;
|
|
203
|
+
CDN: (id: string, size?: number, forceStatic?: boolean) => string;
|
|
204
|
+
};
|
|
205
|
+
SevenTV: {
|
|
206
|
+
Global: string;
|
|
207
|
+
Channel: (id: string) => string;
|
|
208
|
+
CDN: (id: string, format: string, size?: number, forceStatic?: boolean) => string;
|
|
209
|
+
};
|
|
210
|
+
FFZ: {
|
|
211
|
+
sets: {
|
|
212
|
+
Global: number;
|
|
213
|
+
Modifiers: number;
|
|
214
|
+
};
|
|
215
|
+
Set: (id: string) => string;
|
|
216
|
+
Channel: (id: string) => string;
|
|
217
|
+
CDN: (id: string, size?: number) => string;
|
|
218
|
+
CDNAnimated: (id: string, size?: number) => string;
|
|
219
|
+
};
|
|
220
|
+
Templates: {
|
|
221
|
+
html: string;
|
|
222
|
+
markdown: string;
|
|
223
|
+
bbcode: string;
|
|
224
|
+
plain: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare class Collection<K, V> extends Map<K, V> {
|
|
229
|
+
public find (
|
|
230
|
+
propOrFunc: string | ((item: V, index: number, coll: this) => boolean),
|
|
231
|
+
value?: any
|
|
232
|
+
): V
|
|
233
|
+
|
|
234
|
+
public filter (
|
|
235
|
+
func: (item: V, index: number, coll: this) => boolean
|
|
236
|
+
): Collection<K, V>
|
|
237
|
+
|
|
238
|
+
public map (
|
|
239
|
+
func: (item: V, index: number, coll: this) => any
|
|
240
|
+
): Array<any>
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export {
|
|
244
|
+
Channel,
|
|
245
|
+
Emote,
|
|
246
|
+
EmoteFetcher,
|
|
247
|
+
EmoteParser,
|
|
248
|
+
TwitchEmote,
|
|
249
|
+
BTTVEmote,
|
|
250
|
+
FFZEmote,
|
|
251
|
+
SevenTVEmote,
|
|
252
|
+
Collection,
|
|
253
|
+
Constants,
|
|
254
|
+
}
|