@mkody/twitch-emoticons 3.0.0-beta.6 → 3.0.0-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkody/twitch-emoticons",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -50,18 +50,18 @@
50
50
  "jsdelivr": "./dist/TwitchEmoticons.min.js",
51
51
  "unpkg": "./dist/TwitchEmoticons.min.js",
52
52
  "dependencies": {
53
- "@twurple/api": "^8.1.3",
54
- "@twurple/auth": "^8.1.3"
53
+ "@twurple/api": "^8.1.4",
54
+ "@twurple/auth": "^8.1.4"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@microsoft/eslint-formatter-sarif": "^3.1.0",
58
- "@typescript-eslint/parser": "^8.59.0",
58
+ "@typescript-eslint/parser": "^8.61.0",
59
59
  "cross-env": "^10.1.0",
60
60
  "docdash": "^2.0.2",
61
- "esbuild": "^0.28.0",
61
+ "esbuild": "^0.28.1",
62
62
  "eslint": "^9.39.4",
63
- "eslint-plugin-jsdoc": "^62.9.0",
64
- "jest": "^30.3.0",
63
+ "eslint-plugin-jsdoc": "^63.0.2",
64
+ "jest": "^30.4.2",
65
65
  "jsdoc": "^4.0.5",
66
66
  "neostandard": "^0.13.0"
67
67
  },
@@ -89,14 +89,7 @@
89
89
  "test": "test"
90
90
  },
91
91
  "engines": {
92
- "node": ">=20.18.1",
93
- "pnpm": ">=10"
92
+ "node": ">=20.18.1"
94
93
  },
95
- "packageManager": "pnpm@10.33.2",
96
- "pnpm": {
97
- "onlyBuiltDependencies": [
98
- "esbuild",
99
- "unrs-resolver"
100
- ]
101
- }
94
+ "packageManager": "pnpm@11.7.0"
102
95
  }
@@ -5,6 +5,7 @@ class EmoteParser {
5
5
  * A parser to replace text with emotes.
6
6
  * @param {EmoteFetcher} fetcher - The {@linkcode EmoteFetcher} to use the cache of.
7
7
  * @param {object} [options={}] - Options for the parser.
8
+ * @param {boolean} [options.allowNSFW=false] - Only for 7TV: allow usage of NSFW/unlisted emotes.
8
9
  * @param {string} [options.template=''] - The template to be used.
9
10
  * The strings that can be interpolated are:
10
11
  * - `{link}` The link of the emote.
@@ -29,6 +30,7 @@ class EmoteParser {
29
30
  * @type {object}
30
31
  */
31
32
  this.options = {
33
+ allowNSFW: false,
32
34
  template: '',
33
35
  type: 'html',
34
36
  match: /([^\s]+)/g,
@@ -92,6 +94,7 @@ class EmoteParser {
92
94
  const emote = this.fetcher.emotes.get(id)
93
95
  if (!emote) return matched
94
96
  if (emote.modifier) return ''
97
+ if (emote.nsfw && !this.options.allowNSFW) return matched
95
98
 
96
99
  const template = this.options.template || Constants.Templates[this.options.type]
97
100
  const link = emote.toLink({ size, forceStatic, themeMode })
@@ -81,11 +81,11 @@ class SevenTVEmote extends Emote {
81
81
  this.zeroWidth = (data.flags & ActiveEmoteFlags.ZeroWidth) !== 0 || (data.data.flags & EmoteFlags.ZeroWidth) !== 0
82
82
 
83
83
  /**
84
- * If emote is NSFW (or Twitch disallowed, just in case).
84
+ * If emote is NSFW/unlisted (or Twitch disallowed, just in case).
85
85
  * Do note that this flag isn't always applied to what *looks* NSFW.
86
86
  * @type {boolean}
87
87
  */
88
- this.nsfw = (data.data.flags & EmoteFlags.Sexual) !== 0 || (data.data.flags & EmoteFlags.TwitchDisallowed) !== 0
88
+ this.nsfw = (data.data.flags & EmoteFlags.Sexual) !== 0 || (data.data.flags & EmoteFlags.TwitchDisallowed) !== 0 || data.data.listed === false
89
89
  }
90
90
 
91
91
  /**
@@ -25,6 +25,7 @@ export default {
25
25
  name
26
26
  }
27
27
  }
28
+ listed
28
29
  owner {
29
30
  display_name
30
31
  }
@@ -50,6 +51,7 @@ export default {
50
51
  name
51
52
  }
52
53
  }
54
+ listed
53
55
  owner {
54
56
  display_name
55
57
  }
@@ -145,6 +145,7 @@ declare class EmoteParser {
145
145
  * A parser to replace text with emotes.
146
146
  * @param {EmoteFetcher} fetcher - The {@linkcode EmoteFetcher} to use the cache of.
147
147
  * @param {object} [options={}] - Options for the parser.
148
+ * @param {boolean} [options.allowNSFW=false] - Only for 7TV: allow usage of NSFW/unlisted emotes.
148
149
  * @param {string} [options.template=''] - The template to be used.
149
150
  * The strings that can be interpolated are:
150
151
  * - `{link}` The link of the emote.
@@ -160,6 +161,7 @@ declare class EmoteParser {
160
161
  public constructor (
161
162
  fetcher: EmoteFetcher,
162
163
  options?: {
164
+ allowNSFW?: boolean,
163
165
  template?: string,
164
166
  type?: 'html' | 'markdown' | 'bbcode' | 'plain',
165
167
  match?: RegExp
@@ -145,6 +145,7 @@ export class EmoteParser {
145
145
  * A parser to replace text with emotes.
146
146
  * @param {EmoteFetcher} fetcher - The {@linkcode EmoteFetcher} to use the cache of.
147
147
  * @param {object} [options={}] - Options for the parser.
148
+ * @param {boolean} [options.allowNSFW=false] - Only for 7TV: allow usage of NSFW/unlisted emotes.
148
149
  * @param {string} [options.template=''] - The template to be used.
149
150
  * The strings that can be interpolated are:
150
151
  * - `{link}` The link of the emote.
@@ -160,6 +161,7 @@ export class EmoteParser {
160
161
  public constructor (
161
162
  fetcher: EmoteFetcher,
162
163
  options?: {
164
+ allowNSFW?: boolean,
163
165
  template?: string,
164
166
  type?: 'html' | 'markdown' | 'bbcode' | 'plain',
165
167
  match?: RegExp