@tixyel/streamelements 7.9.0 → 7.11.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/dist/index.es.js CHANGED
@@ -10073,6 +10073,12 @@ var j = class {
10073
10073
  let M = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
10074
10074
  return M = n.method === "loop" ? k(M) : A(M), M;
10075
10075
  }
10076
+ removeNewlines(e) {
10077
+ return e.replace(/\r?\n|\r/g, " ");
10078
+ }
10079
+ removeExtraSpaces(e) {
10080
+ return e.replace(/\s+/g, " ").trim();
10081
+ }
10076
10082
  }, ee = class {
10077
10083
  constructor() {
10078
10084
  this.playing = !1;
@@ -10181,93 +10187,96 @@ var j = class {
10181
10187
  }
10182
10188
  return 1;
10183
10189
  }
10184
- async identifyUser(e, t, n) {
10185
- let r = (e) => ({
10186
- gifter: n["subscriber-alltime-gifter"].name === e,
10190
+ async identifyUser(t, n, r) {
10191
+ let { getTops: i } = new e();
10192
+ switch (t) {
10193
+ case "twitch": {
10194
+ let e = n.event.data, t = !1;
10195
+ return e.tags["badge-info"]?.includes("subscriber") && (t = await this.findSubscriptionTier({
10196
+ userId: e.userId,
10197
+ name: e.displayName,
10198
+ broadcasterId: e.tags["room-id"]
10199
+ }, r ?? {}, !1)), {
10200
+ id: e.userId,
10201
+ name: e.displayName,
10202
+ color: e.displayColor,
10203
+ role: e.tags.badges.split(",")[0].split("/")[0],
10204
+ tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
10205
+ badges: e.badges,
10206
+ tier: t || void 0,
10207
+ top: i(e.displayName, r)
10208
+ };
10209
+ }
10210
+ case "youtube": {
10211
+ let e = n.event.data, t = e.authorDetails.isChatOwner ? "broadcaster" : e.authorDetails.isChatModerator ? "moderator" : e.authorDetails.isChatSponsor ? "sponsor" : e.authorDetails.isVerified ? "verified" : "viewer";
10212
+ return {
10213
+ id: e.userId,
10214
+ name: e.displayName,
10215
+ role: t,
10216
+ badges: e.badges,
10217
+ top: i(e.displayName, r)
10218
+ };
10219
+ }
10220
+ }
10221
+ }
10222
+ getTops(e, t) {
10223
+ return {
10224
+ gifter: t["subscriber-alltime-gifter"].name === e,
10187
10225
  tip: {
10188
10226
  session: {
10189
- donator: n["tip-session-top-donator"].name === e,
10190
- donation: n["tip-session-top-donation"].name === e
10227
+ donator: t["tip-session-top-donator"].name === e,
10228
+ donation: t["tip-session-top-donation"].name === e
10191
10229
  },
10192
10230
  weekly: {
10193
- donator: n["tip-weekly-top-donator"].name === e,
10194
- donation: n["tip-weekly-top-donation"].name === e
10231
+ donator: t["tip-weekly-top-donator"].name === e,
10232
+ donation: t["tip-weekly-top-donation"].name === e
10195
10233
  },
10196
10234
  monthly: {
10197
- donator: n["tip-monthly-top-donator"].name === e,
10198
- donation: n["tip-monthly-top-donation"].name === e
10235
+ donator: t["tip-monthly-top-donator"].name === e,
10236
+ donation: t["tip-monthly-top-donation"].name === e
10199
10237
  },
10200
10238
  alltime: {
10201
- donator: n["tip-alltime-top-donator"].name === e,
10202
- donation: n["tip-alltime-top-donation"].name === e
10239
+ donator: t["tip-alltime-top-donator"].name === e,
10240
+ donation: t["tip-alltime-top-donation"].name === e
10203
10241
  }
10204
10242
  },
10205
10243
  cheer: {
10206
10244
  session: {
10207
- donator: n["cheer-session-top-donator"].name === e,
10208
- amount: n["cheer-session-top-donation"].name === e
10245
+ donator: t["cheer-session-top-donator"].name === e,
10246
+ amount: t["cheer-session-top-donation"].name === e
10209
10247
  },
10210
10248
  weekly: {
10211
- donator: n["cheer-weekly-top-donator"].name === e,
10212
- amount: n["cheer-weekly-top-donation"].name === e
10249
+ donator: t["cheer-weekly-top-donator"].name === e,
10250
+ amount: t["cheer-weekly-top-donation"].name === e
10213
10251
  },
10214
10252
  monthly: {
10215
- donator: n["cheer-monthly-top-donator"].name === e,
10216
- amount: n["cheer-monthly-top-donation"].name === e
10253
+ donator: t["cheer-monthly-top-donator"].name === e,
10254
+ amount: t["cheer-monthly-top-donation"].name === e
10217
10255
  },
10218
10256
  alltime: {
10219
- donator: n["cheer-alltime-top-donator"].name === e,
10220
- amount: n["cheer-alltime-top-donation"].name === e
10257
+ donator: t["cheer-alltime-top-donator"].name === e,
10258
+ amount: t["cheer-alltime-top-donation"].name === e
10221
10259
  }
10222
10260
  },
10223
10261
  superchat: {
10224
10262
  session: {
10225
- donator: n["superchat-session-top-donator"].name === e,
10226
- amount: n["superchat-session-top-donation"].name === e
10263
+ donator: t["superchat-session-top-donator"].name === e,
10264
+ amount: t["superchat-session-top-donation"].name === e
10227
10265
  },
10228
10266
  weekly: {
10229
- donator: n["superchat-weekly-top-donator"].name === e,
10230
- amount: n["superchat-weekly-top-donation"].name === e
10267
+ donator: t["superchat-weekly-top-donator"].name === e,
10268
+ amount: t["superchat-weekly-top-donation"].name === e
10231
10269
  },
10232
10270
  monthly: {
10233
- donator: n["superchat-monthly-top-donator"].name === e,
10234
- amount: n["superchat-monthly-top-donation"].name === e
10271
+ donator: t["superchat-monthly-top-donator"].name === e,
10272
+ amount: t["superchat-monthly-top-donation"].name === e
10235
10273
  },
10236
10274
  alltime: {
10237
- donator: n["superchat-alltime-top-donator"].name === e,
10238
- amount: n["superchat-alltime-top-donation"].name === e
10275
+ donator: t["superchat-alltime-top-donator"].name === e,
10276
+ amount: t["superchat-alltime-top-donation"].name === e
10239
10277
  }
10240
10278
  }
10241
- });
10242
- switch (e) {
10243
- case "twitch": {
10244
- let e = t.event.data, i = !1;
10245
- return e.tags["badge-info"]?.includes("subscriber") && (i = await this.findSubscriptionTier({
10246
- userId: e.userId,
10247
- name: e.displayName,
10248
- broadcasterId: e.tags["room-id"]
10249
- }, n ?? {}, !1)), {
10250
- id: e.userId,
10251
- name: e.displayName,
10252
- color: e.displayColor,
10253
- role: e.tags.badges.split(",")[0].split("/")[0],
10254
- tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
10255
- badges: e.badges,
10256
- tier: i || void 0,
10257
- top: r(e.displayName)
10258
- };
10259
- }
10260
- case "youtube": {
10261
- let e = t.event.data, n = e.authorDetails.isChatOwner ? "broadcaster" : e.authorDetails.isChatModerator ? "moderator" : e.authorDetails.isChatSponsor ? "sponsor" : e.authorDetails.isVerified ? "verified" : "viewer";
10262
- return {
10263
- id: e.userId,
10264
- name: e.displayName,
10265
- role: n,
10266
- badges: e.badges,
10267
- top: r(e.displayName)
10268
- };
10269
- }
10270
- }
10279
+ };
10271
10280
  }
10272
10281
  identifyMessage(e, t, n) {
10273
10282
  let r = /<img[^>]*class="emote"[^>]*>/gi;
@@ -10622,7 +10631,7 @@ var oe = class e {
10622
10631
  }
10623
10632
  }, V = class e {
10624
10633
  constructor(e) {
10625
- this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, I.push(this), N.length && N.forEach((e) => {
10634
+ this.prefix = "!", this.arguments = !1, this.test = () => !0, this.aliases = [], this.permissions = void 0, this.admins = [], this.prefix = e.prefix ?? this.prefix, this.name = e.name, this.description = e.description ?? this.description, this.arguments = e.arguments ?? this.arguments, this.run = e.run, this.test = e.test ?? this.test, this.aliases = e.aliases ?? this.aliases, this.permissions = e.permissions ?? this.permissions, this.admins = e.admins ?? this.admins, I.push(this), N.length && N.forEach((e) => {
10626
10635
  e.actions.commands.push(this), e.emit("action", this, "created");
10627
10636
  });
10628
10637
  }
@@ -10637,6 +10646,7 @@ var oe = class e {
10637
10646
  bits: "cheer",
10638
10647
  premium: "prime"
10639
10648
  };
10649
+ if (this.test instanceof RegExp && !this.test.test(e) || typeof this.test == "function" && !this.test(e)) return !1;
10640
10650
  switch (t.provider) {
10641
10651
  case "twitch": {
10642
10652
  let e = t.data;