@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.
Files changed (80) hide show
  1. package/README.md +530 -169
  2. package/dist/TwitchEmoticons.cjs +950 -0
  3. package/dist/TwitchEmoticons.esm.min.js +7 -0
  4. package/dist/TwitchEmoticons.esm.min.js.map +7 -0
  5. package/dist/TwitchEmoticons.min.js +2 -20
  6. package/dist/TwitchEmoticons.min.js.map +4 -4
  7. package/package.json +99 -72
  8. package/src/index.js +38 -12
  9. package/src/struct/BTTVEmote.js +72 -74
  10. package/src/struct/Channel.js +48 -48
  11. package/src/struct/Emote.js +71 -71
  12. package/src/struct/EmoteFetcher.js +358 -322
  13. package/src/struct/EmoteParser.js +95 -84
  14. package/src/struct/EmoteTypeMapper.js +9 -9
  15. package/src/struct/FFZEmote.js +91 -93
  16. package/src/struct/SevenTVEmote.js +88 -90
  17. package/src/struct/TwitchEmote.js +72 -71
  18. package/src/util/Collection.js +69 -55
  19. package/src/util/Constants.js +30 -30
  20. package/typings/index.d.cts +254 -0
  21. package/typings/index.d.ts +216 -99
  22. package/.jsdoc.json +0 -46
  23. package/.nvmrc +0 -1
  24. package/docs/BTTVEmote.html +0 -1532
  25. package/docs/Channel.html +0 -824
  26. package/docs/Collection.html +0 -798
  27. package/docs/Emote.html +0 -832
  28. package/docs/EmoteFetcher.html +0 -3741
  29. package/docs/EmoteParser.html +0 -1187
  30. package/docs/FFZEmote.html +0 -1686
  31. package/docs/SevenTVEmote.html +0 -1596
  32. package/docs/TwitchEmote.html +0 -1528
  33. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  34. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  35. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  36. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  37. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  38. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  39. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  40. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  41. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  42. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
  43. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  44. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  45. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  46. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  47. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
  48. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  49. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  50. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  51. package/docs/index.html +0 -233
  52. package/docs/scripts/collapse.js +0 -39
  53. package/docs/scripts/commonNav.js +0 -28
  54. package/docs/scripts/linenumber.js +0 -25
  55. package/docs/scripts/nav.js +0 -12
  56. package/docs/scripts/polyfill.js +0 -4
  57. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  58. package/docs/scripts/prettify/lang-css.js +0 -2
  59. package/docs/scripts/prettify/prettify.js +0 -28
  60. package/docs/scripts/search.js +0 -99
  61. package/docs/struct_BTTVEmote.js.html +0 -162
  62. package/docs/struct_Channel.js.html +0 -132
  63. package/docs/struct_Emote.js.html +0 -159
  64. package/docs/struct_EmoteFetcher.js.html +0 -429
  65. package/docs/struct_EmoteParser.js.html +0 -172
  66. package/docs/struct_FFZEmote.js.html +0 -185
  67. package/docs/struct_SevenTVEmote.js.html +0 -180
  68. package/docs/struct_TwitchEmote.js.html +0 -159
  69. package/docs/styles/jsdoc.css +0 -776
  70. package/docs/styles/prettify.css +0 -80
  71. package/docs/util_Collection.js.html +0 -151
  72. package/eslint.config.mjs +0 -215
  73. package/jest.config.js +0 -198
  74. package/test/BTTV.test.js +0 -48
  75. package/test/FFZ.test.js +0 -71
  76. package/test/SevenTV.test.js +0 -71
  77. package/test/ToFromObject.test.js +0 -156
  78. package/test/Twitch.test.js +0 -64
  79. package/test/__snapshots__/ToFromObject.test.js.snap +0 -121
  80. package/test/other.test.js +0 -72
package/package.json CHANGED
@@ -1,75 +1,102 @@
1
1
  {
2
- "name": "@mkody/twitch-emoticons",
3
- "version": "2.9.6",
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
- "contributors": [
22
- "1Computer",
23
- "Killusions",
24
- "MKody",
25
- "Tzahi12345"
26
- ],
27
- "license": "MIT",
28
- "dependencies": {
29
- "@twurple/api": "^7.4.0",
30
- "@twurple/auth": "^7.4.0",
31
- "axios": "^1.13.5"
32
- },
33
- "devDependencies": {
34
- "@eslint/js": "^9.39.3",
35
- "@jest/globals": "^30.2.0",
36
- "@microsoft/eslint-formatter-sarif": "^3.1.0",
37
- "docdash": "^2.0.2",
38
- "esbuild": "^0.27.3",
39
- "eslint": "^9.39.3",
40
- "eslint-plugin-jsdoc": "^61.7.1",
41
- "globals": "^16.5.0",
42
- "jest": "^30.2.0",
43
- "jsdoc": "^4.0.5"
44
- },
45
- "scripts": {
46
- "all": "pnpm run lint && pnpm run test && pnpm run build && pnpm run docs",
47
- "build": "esbuild ./src/index.js --bundle --minify --keep-names --sourcemap --format=esm --outfile=./dist/TwitchEmoticons.min.js",
48
- "docs": "jsdoc --configure .jsdoc.json",
49
- "lint": "eslint ./src ./test",
50
- "test": "jest"
51
- },
52
- "repository": {
53
- "type": "git",
54
- "url": "git+https://github.com/mkody/twitch-emoticons.git"
55
- },
56
- "bugs": {
57
- "url": "https://github.com/mkody/twitch-emoticons/issues"
58
- },
59
- "homepage": "https://github.com/mkody/twitch-emoticons",
60
- "directories": {
61
- "doc": "docs",
62
- "test": "test"
63
- },
64
- "engines": {
65
- "node": ">=18.0.0",
66
- "pnpm": ">=9"
67
- },
68
- "packageManager": "pnpm@10.24.0",
69
- "pnpm": {
70
- "onlyBuiltDependencies": [
71
- "esbuild",
72
- "unrs-resolver"
73
- ]
2
+ "name": "@mkody/twitch-emoticons",
3
+ "version": "3.0.0-beta.2",
4
+ "description": "Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "MKody <gh@kdy.ch> (André Fernandes)",
8
+ "contributors": [
9
+ "1Computer",
10
+ "Killusions",
11
+ "MKody",
12
+ "Tzahi12345"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/mkody/twitch-emoticons.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/mkody/twitch-emoticons/issues"
20
+ },
21
+ "homepage": "https://github.com/mkody/twitch-emoticons",
22
+ "keywords": [
23
+ "7tv",
24
+ "bettertwitchtv",
25
+ "bttv",
26
+ "emotes",
27
+ "emoticons",
28
+ "ffz",
29
+ "frankerfacez",
30
+ "parse",
31
+ "seventv",
32
+ "twitch-api",
33
+ "twitch"
34
+ ],
35
+ "sideEffects": false,
36
+ "exports": {
37
+ ".": {
38
+ "import": {
39
+ "types": "./typings/index.d.ts",
40
+ "default": "./src/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./typings/index.d.cts",
44
+ "default": "./dist/TwitchEmoticons.cjs"
45
+ }
74
46
  }
47
+ },
48
+ "types": "./typings/index.d.ts",
49
+ "main": "./dist/TwitchEmoticons.cjs",
50
+ "jsdelivr": "./dist/TwitchEmoticons.min.js",
51
+ "unpkg": "./dist/TwitchEmoticons.min.js",
52
+ "dependencies": {
53
+ "@twurple/api": "^8.0.3",
54
+ "@twurple/auth": "^8.0.3"
55
+ },
56
+ "devDependencies": {
57
+ "@microsoft/eslint-formatter-sarif": "^3.1.0",
58
+ "@typescript-eslint/parser": "^8.56.1",
59
+ "cross-env": "^10.1.0",
60
+ "docdash": "^2.0.2",
61
+ "esbuild": "^0.27.3",
62
+ "eslint": "^9.39.3",
63
+ "eslint-plugin-jsdoc": "^62.7.1",
64
+ "jest": "^30.2.0",
65
+ "jsdoc": "^4.0.5",
66
+ "neostandard": "^0.13.0"
67
+ },
68
+ "scripts": {
69
+ "all": "pnpm run lint && pnpm run test && pnpm run esbuild && pnpm run build:docs",
70
+ "build:cjs": "esbuild src/index.js --bundle --platform=node --outfile=dist/TwitchEmoticons.cjs --format=cjs --packages=external",
71
+ "build:docs": "jsdoc --configure .jsdoc.json",
72
+ "build:esm": "esbuild src/index.js --bundle --minify --keep-names --sourcemap --format=esm --outfile=dist/TwitchEmoticons.esm.min.js",
73
+ "build:global": "esbuild src/index.js --bundle --minify --keep-names --sourcemap --format=iife --global-name=TwitchEmoticons --outfile=dist/TwitchEmoticons.min.js",
74
+ "esbuild": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:global",
75
+ "lint": "eslint .",
76
+ "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest"
77
+ },
78
+ "publishConfig": {
79
+ "access": "public"
80
+ },
81
+ "files": [
82
+ "dist/",
83
+ "src/",
84
+ "typings/",
85
+ "SECURITY.md"
86
+ ],
87
+ "directories": {
88
+ "doc": "docs",
89
+ "test": "test"
90
+ },
91
+ "engines": {
92
+ "node": ">=20.18.1",
93
+ "pnpm": ">=10"
94
+ },
95
+ "packageManager": "pnpm@10.30.3",
96
+ "pnpm": {
97
+ "onlyBuiltDependencies": [
98
+ "esbuild",
99
+ "unrs-resolver"
100
+ ]
101
+ }
75
102
  }
package/src/index.js CHANGED
@@ -1,12 +1,38 @@
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
+ /// <reference types="../typings/index.d.ts" />
2
+ import BTTVEmote from './struct/BTTVEmote.js'
3
+ import Channel from './struct/Channel.js'
4
+ import Collection from './util/Collection.js'
5
+ import Constants from './util/Constants.js'
6
+ import Emote from './struct/Emote.js'
7
+ import EmoteFetcher from './struct/EmoteFetcher.js'
8
+ import EmoteParser from './struct/EmoteParser.js'
9
+ import FFZEmote from './struct/FFZEmote.js'
10
+ import SevenTVEmote from './struct/SevenTVEmote.js'
11
+ import TwitchEmote from './struct/TwitchEmote.js'
12
+
13
+ export {
14
+ BTTVEmote,
15
+ Channel,
16
+ Collection,
17
+ Constants,
18
+ Emote,
19
+ EmoteFetcher,
20
+ EmoteParser,
21
+ FFZEmote,
22
+ SevenTVEmote,
23
+ TwitchEmote,
24
+ }
25
+
26
+ // Default export for compatibility
27
+ export default {
28
+ BTTVEmote,
29
+ Channel,
30
+ Collection,
31
+ Constants,
32
+ Emote,
33
+ EmoteFetcher,
34
+ EmoteParser,
35
+ FFZEmote,
36
+ SevenTVEmote,
37
+ TwitchEmote,
38
+ }
@@ -1,90 +1,88 @@
1
- const Emote = require('./Emote');
2
- const Constants = require('../util/Constants');
1
+ import Emote from './Emote.js'
2
+ import Constants from '../util/Constants.js'
3
3
 
4
4
  /** @augments Emote */
5
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;
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
+ }
36
16
 
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
- }
17
+ _setup (data) {
18
+ super._setup(data)
49
19
 
50
20
  /**
51
- * Gets the image link of the emote.
52
- * @param {number} size - The size of the image, 0, 1, or 2.
53
- * @returns {string}
21
+ * The name of the emote creator's channel.
22
+ * Will be null for global or channel emotes.
23
+ * @type {?string}
54
24
  */
55
- toLink(size = 0) {
56
- return Constants.BTTV.CDN(this.id, size); // eslint-disable-line new-cap
57
- }
25
+ this.ownerName = 'user' in data ? data.user.name : null
58
26
 
59
27
  /**
60
- * Override for `toObject`.
61
- * Will result in an Object representation of a BTTVEmote
62
- * @returns {object}
28
+ * If emote is animated.
29
+ * @type {boolean}
63
30
  */
64
- toObject() {
65
- return Object.assign({}, super.toObject(), {
66
- animated: this.animated,
67
- ownerName: this.ownerName,
68
- type: this.type
69
- });
70
- }
31
+ this.animated = data.animated
71
32
 
72
33
  /**
73
- * Converts an emote Object into a BTTVEmote
74
- * @param {object} [emoteObject] - Object representation of this emote
75
- * @param {Channel} [channel=null] - Channel this emote belongs to.
76
- * @returns {BTTVEmote}
34
+ * The image type of the emote.
35
+ * @type {string}
77
36
  */
78
- static fromObject(emoteObject, channel = null) {
79
- return new BTTVEmote(channel, emoteObject.id,
80
- {
81
- code: emoteObject.code,
82
- animated: emoteObject.animated,
83
- user: {
84
- name: emoteObject.ownerName
85
- }
86
- });
37
+ this.imageType = 'webp'
38
+ }
39
+
40
+ /**
41
+ * Gets the image link of the emote.
42
+ * @param {object} [options] - Options for the link.
43
+ * @param {number} [options.size=0] - Size (scale) for the emote.
44
+ * @param {boolean} [options.forceStatic] - Whether to force the emote to be static (non-animated). Defaults to the fetcher's forceStatic or `false`.
45
+ * @returns {string} - The URL to the emote.
46
+ */
47
+ toLink (options) {
48
+ const {
49
+ size = 0,
50
+ forceStatic = this.fetcher.forceStatic || false,
51
+ } = options || {}
52
+
53
+ return Constants.BTTV.CDN(this.id, size, forceStatic)
54
+ }
55
+
56
+ /**
57
+ * Override for `toObject`.
58
+ * Will result in an Object representation of a BTTVEmote
59
+ * @returns {object} - Object representation of the BTTVEmote.
60
+ */
61
+ toObject () {
62
+ return {
63
+ ...super.toObject(),
64
+ animated: this.animated,
65
+ ownerName: this.ownerName,
66
+ type: this.type,
87
67
  }
68
+ }
69
+
70
+ /**
71
+ * Converts an emote Object into a BTTVEmote
72
+ * @param {object} [emoteObject] - Object representation of this emote
73
+ * @param {Channel} [channel] - Channel this emote belongs to.
74
+ * @returns {BTTVEmote} - A BTTVEmote instance.
75
+ */
76
+ static fromObject (emoteObject, channel) {
77
+ return new BTTVEmote(channel, emoteObject.id,
78
+ {
79
+ code: emoteObject.code,
80
+ animated: emoteObject.animated,
81
+ user: {
82
+ name: emoteObject.ownerName,
83
+ },
84
+ })
85
+ }
88
86
  }
89
87
 
90
- module.exports = BTTVEmote;
88
+ export default BTTVEmote
@@ -1,60 +1,60 @@
1
- const Collection = require('../util/Collection');
1
+ import Collection from '../util/Collection.js'
2
2
 
3
3
  class Channel {
4
+ /**
5
+ * A Twitch channel.
6
+ * @param {EmoteFetcher} fetcher - The emote fetcher.
7
+ * @param {number} id - ID of the channel.
8
+ */
9
+ constructor (fetcher, id) {
4
10
  /**
5
- * A Twitch channel.
6
- * @param {EmoteFetcher} fetcher - The emote fetcher.
7
- * @param {int} id - ID of the channel.
11
+ * The emote fetcher.
12
+ * @type {EmoteFetcher}
8
13
  */
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
- /* There are tests that those are returning Collections, but c8 doesn't get it. */
31
- /* c8 ignore start */
14
+ this.fetcher = fetcher
32
15
 
33
16
  /**
34
- * Fetches the BTTV emotes for this channel.
35
- * @returns {Promise<Collection<string, BTTVEmote>>}
17
+ * The ID of this channel.
18
+ * For the global channel, the ID will be null.
19
+ * @type {?number}
36
20
  */
37
- fetchBTTVEmotes() {
38
- return this.fetcher.fetchBTTVEmotes(this.id);
39
- }
21
+ this.channel_id = id || null
40
22
 
41
23
  /**
42
- * Fetches the FFZ emotes for this channel.
43
- * @returns {Promise<Collection<string, FFZEmote>>}
24
+ * Cached emotes belonging to this channel.
25
+ * @type {Collection<string, Emote>}
44
26
  */
45
- fetchFFZEmotes() {
46
- return this.fetcher.fetchFFZEmotes(this.id);
47
- }
48
-
49
- /**
50
- * Fetches the 7TV emotes for this channel.
51
- * @returns {Promise<Collection<string, SevenTVEmote>>}
52
- */
53
- fetchSevenTVEmotes() {
54
- return this.fetcher.fetchSevenTVEmotes(this.id);
55
- }
56
-
57
- /* c8 ignore end */
27
+ this.emotes = new Collection()
28
+ }
29
+
30
+ /* There are tests that those are returning Collections, but c8 doesn't get it. */
31
+ /* c8 ignore start */
32
+
33
+ /**
34
+ * Fetches the BTTV emotes for this channel.
35
+ * @returns {Promise<Collection<string, BTTVEmote>>} - A promise that resolves to a collection of BTTVEmotes.
36
+ */
37
+ fetchBTTVEmotes () {
38
+ return this.fetcher.fetchBTTVEmotes(this.id)
39
+ }
40
+
41
+ /**
42
+ * Fetches the FFZ emotes for this channel.
43
+ * @returns {Promise<Collection<string, FFZEmote>>} - A promise that resolves to a collection of FFZEmotes.
44
+ */
45
+ fetchFFZEmotes () {
46
+ return this.fetcher.fetchFFZEmotes(this.id)
47
+ }
48
+
49
+ /**
50
+ * Fetches the 7TV emotes for this channel.
51
+ * @returns {Promise<Collection<string, SevenTVEmote>>} - A promise that resolves to a collection of SevenTVEmotes.
52
+ */
53
+ fetchSevenTVEmotes () {
54
+ return this.fetcher.fetchSevenTVEmotes(this.id)
55
+ }
56
+
57
+ /* c8 ignore end */
58
58
  }
59
59
 
60
- module.exports = Channel;
60
+ export default Channel
@@ -1,87 +1,87 @@
1
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
+ * @throws {Error} When trying to use the base Emote class directly.
9
+ */
10
+ constructor (channel, id, data) {
11
+ if (new.target.name === Emote.name) {
12
+ throw new Error('Base Emote class cannot be used')
13
+ }
14
+
2
15
  /**
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
- * @throws {Error} When trying to use the base Emote class directly.
16
+ * The emote fetcher.
17
+ * @type {EmoteFetcher}
9
18
  */
10
- constructor(channel, id, data) {
11
- if (new.target.name === Emote.name) {
12
- throw new Error('Base Emote class cannot be used');
13
- }
14
-
15
- /**
16
- * The emote fetcher.
17
- * @type {EmoteFetcher}
18
- */
19
- this.fetcher = channel.fetcher;
20
-
21
- /**
22
- * The channel this emote belongs to.
23
- * Only accurate and constant on Twitch emotes.
24
- * For other types of emotes, use the `owner` or `ownerName` property.
25
- * @type {Channel}
26
- */
27
- this.channel = channel;
28
-
29
- /**
30
- * The ID of this emote.
31
- * @type {string}
32
- */
33
- this.id = id;
19
+ this.fetcher = channel.fetcher
34
20
 
35
- /**
36
- * The type of this emote.
37
- * Either `twitch`, `bttv`, `ffz`, or '7tv'.
38
- * @type {string}
39
- */
40
- this.type = null;
41
-
42
- this._setup(data);
43
- }
44
-
45
- _setup(data) {
46
- /**
47
- * The code or name of the emote.
48
- * @type {string}
49
- */
50
- this.code = data.code;
51
- }
21
+ /**
22
+ * The channel this emote belongs to.
23
+ * Only accurate and constant on Twitch emotes.
24
+ * For other types of emotes, use the `owner` or `ownerName` property.
25
+ * @type {Channel}
26
+ */
27
+ this.channel = channel
52
28
 
53
29
  /**
54
- * Gets the image link of the emote.
55
- * @param {number} size - The size of the image.
56
- * @returns {string}
30
+ * The ID of this emote.
31
+ * @type {string}
57
32
  */
58
- /* c8 ignore next 3*/
59
- toLink() {
60
- return null;
61
- }
33
+ this.id = id
62
34
 
63
35
  /**
64
- * Override for `toString`.
65
- * Will give the emote's name.
66
- * @returns {string}
36
+ * The type of this emote.
37
+ * Either `twitch`, `bttv`, `ffz`, or '7tv'.
38
+ * @type {string | null}
67
39
  */
68
- /* c8 ignore next 3*/
69
- toString() {
70
- return this.code;
71
- }
40
+ this.type = null
72
41
 
42
+ this._setup(data)
43
+ }
44
+
45
+ _setup (data) {
73
46
  /**
74
- * Override for `toObject`.
75
- * Will result in an Object representation of an Emote
76
- * @returns {object}
47
+ * The code or name of the emote.
48
+ * @type {string}
77
49
  */
78
- toObject() {
79
- return {
80
- code: this.code,
81
- id: this.id,
82
- channel_id: this.channel.channel_id
83
- };
50
+ this.code = data.code
51
+ }
52
+
53
+ /**
54
+ * Gets the image link of the emote.
55
+ * @param {number} size - The size of the image.
56
+ * @returns {string} - The URL to the emote.
57
+ */
58
+ /* c8 ignore next 3 */
59
+ toLink () {
60
+ return null
61
+ }
62
+
63
+ /**
64
+ * Override for `toString`.
65
+ * Will give the emote's name.
66
+ * @returns {string} - The emote code.
67
+ */
68
+ /* c8 ignore next 3 */
69
+ toString () {
70
+ return this.code
71
+ }
72
+
73
+ /**
74
+ * Override for `toObject`.
75
+ * Will result in an Object representation of an Emote
76
+ * @returns {object} - Object representation of the Emote.
77
+ */
78
+ toObject () {
79
+ return {
80
+ code: this.code,
81
+ id: this.id,
82
+ channel_id: this.channel.channel_id,
84
83
  }
84
+ }
85
85
  }
86
86
 
87
- module.exports = Emote;
87
+ export default Emote