@tixyel/streamelements 6.4.0 → 6.4.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/dist/index.d.ts CHANGED
@@ -2686,19 +2686,19 @@ declare namespace Helper {
2686
2686
  * @param obj - The object to get entries from.
2687
2687
  * @returns An array of key-value pairs from the object.
2688
2688
  */
2689
- function typedEntries<K extends string, V>(obj: Record<K, V>): [K, V][];
2689
+ function typedEntries<K extends string, V>(obj: Record<K, V> | Array<V>): [K, V][];
2690
2690
  /**
2691
2691
  * Returns typed values of an object.
2692
2692
  * @param obj - The object to get values from.
2693
2693
  * @returns An array of values from the object.
2694
2694
  */
2695
- function typedValues<K extends string, V>(obj: Record<K, V>): V[];
2695
+ function typedValues<K extends string, V>(obj: Record<K, V> | Array<V>): V[];
2696
2696
  /**
2697
2697
  * Returns typed keys of an object.
2698
2698
  * @param obj - The object to get keys from.
2699
2699
  * @returns An array of keys from the object.
2700
2700
  */
2701
- function typedKeys<K extends string, V>(obj: Record<K, V>): K[];
2701
+ function typedKeys<K extends string, V>(obj: Record<K, V> | Array<V>): K[];
2702
2702
  /**
2703
2703
  * Selects an item based on weighted probabilities.
2704
2704
  * @param items - An object where keys are items and values are their weights.
@@ -2973,7 +2973,7 @@ declare global {
2973
2973
  onEventReceived: CustomEvent<StreamElements.Event.onEventReceived>;
2974
2974
  }
2975
2975
  const Tixyel: typeof main;
2976
- let client: InstanceType<typeof main.Client>;
2976
+ let client: InstanceType<typeof main.Client> | undefined;
2977
2977
  const SE_API: StreamElements.SE_API;
2978
2978
  }
2979
2979
 
package/dist/index.es.js CHANGED
@@ -109,7 +109,7 @@ class it extends X {
109
109
  return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
110
110
  }
111
111
  }
112
- class G extends X {
112
+ class q extends X {
113
113
  constructor(e) {
114
114
  super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
115
115
  commands: [],
@@ -153,7 +153,7 @@ class G extends X {
153
153
  }
154
154
  class Z {
155
155
  constructor(e) {
156
- this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof G && (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, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
156
+ this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof q && (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, window.client.actions.commands.push(this), window.client.emit("action", this, "created"));
157
157
  }
158
158
  run(e, t) {
159
159
  }
@@ -161,7 +161,7 @@ class Z {
161
161
  return this.arguments === !0 && (!a || !a.length) ? !1 : !!(this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) || this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length || Array.isArray(this.permissions) && (this.permissions.some((i) => e.toLowerCase() === i.toLowerCase() || t.map((s) => s.toLowerCase()).includes(i.toLowerCase())) || this.permissions.includes("*")));
162
162
  }
163
163
  parse(e, t) {
164
- if (!(window.client instanceof G)) return !1;
164
+ if (!(window.client instanceof q)) return !1;
165
165
  const a = e.replace(this.prefix, "").split(" ").slice(1).map((c) => c.trim());
166
166
  var i = "", s = [];
167
167
  const n = { bits: "cheer", premium: "prime" };
@@ -188,12 +188,12 @@ class Z {
188
188
  return m === !0 && this.run.apply(window.client, [a, t]), m;
189
189
  }
190
190
  remove() {
191
- if (!(window.client instanceof G)) return;
191
+ if (!(window.client instanceof q)) return;
192
192
  const e = window.client.actions.commands.indexOf(this);
193
193
  e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
194
194
  }
195
195
  static execute(e) {
196
- if (!(window.client instanceof G)) return !1;
196
+ if (!(window.client instanceof q)) return !1;
197
197
  const t = e.data;
198
198
  try {
199
199
  if (window.client.actions.commands.length && window.client.actions.commands.some((a) => t.event.data.text.startsWith(a.prefix))) {
@@ -5649,7 +5649,7 @@ var w;
5649
5649
  let y = "$", v = "USD";
5650
5650
  if (typeof window < "u")
5651
5651
  try {
5652
- const u = window.client?.details?.currency;
5652
+ const u = window?.client?.details?.currency;
5653
5653
  u?.symbol && (y = String(u.symbol)), u?.code && (v = String(u.code));
5654
5654
  } catch {
5655
5655
  }
@@ -6186,7 +6186,7 @@ var w;
6186
6186
  })(w || (w = {}));
6187
6187
  class at {
6188
6188
  constructor(e) {
6189
- this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6189
+ this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof q && (this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
6190
6190
  }
6191
6191
  generate(e) {
6192
6192
  return w.utils.typedValues(e).reduce(
@@ -6212,13 +6212,13 @@ class at {
6212
6212
  return this;
6213
6213
  }
6214
6214
  remove() {
6215
- if (!(window.client instanceof G)) return;
6215
+ if (!(window.client instanceof q)) return;
6216
6216
  const e = window.client.actions.buttons.indexOf(this);
6217
6217
  e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
6218
6218
  }
6219
6219
  static execute(e, t) {
6220
6220
  try {
6221
- if (!(window.client instanceof G)) return !1;
6221
+ if (!(window.client instanceof q)) return !1;
6222
6222
  if (window.client.actions.buttons.length) {
6223
6223
  const a = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, t) : !1);
6224
6224
  if (a.length && a.every((i) => i instanceof at))
@@ -6277,7 +6277,7 @@ class St extends X {
6277
6277
  }
6278
6278
  typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) => {
6279
6279
  const { detail: e } = l;
6280
- if (window.client instanceof G) {
6280
+ if (window.client instanceof q && client instanceof q && client) {
6281
6281
  const t = window.client;
6282
6282
  if (t.fields = e.fieldData, t.session = e.session.data, t.details = {
6283
6283
  ...t.details,
@@ -6334,12 +6334,12 @@ typeof window !== void 0 && (window.addEventListener("onWidgetLoad", async (l) =
6334
6334
  }
6335
6335
  }), window.addEventListener("onSessionUpdate", (l) => {
6336
6336
  const { detail: e } = l;
6337
- if (window.client instanceof G) {
6337
+ if (window.client instanceof q && client instanceof q && client) {
6338
6338
  const t = window.client;
6339
6339
  t.session = e.session, t.emit("session", e.session), t.debug && N.debug("[Client]", "Session updated", e.session);
6340
6340
  }
6341
6341
  }), window.addEventListener("onEventReceived", ({ detail: l }) => {
6342
- if (window.client instanceof G) {
6342
+ if (window.client instanceof q && client instanceof q && client) {
6343
6343
  const t = w.event.parseProvider(l);
6344
6344
  switch (t.provider) {
6345
6345
  case "streamelements": {
@@ -6485,7 +6485,7 @@ class gt extends X {
6485
6485
  this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
6486
6486
  }
6487
6487
  waitForClientAndBindLoad(e = this.duration, t) {
6488
- if (!(window?.client instanceof G)) {
6488
+ if (!(window?.client instanceof q)) {
6489
6489
  setTimeout(
6490
6490
  () => this.waitForClientAndBindLoad(e, t),
6491
6491
  this.clientWaitRetryDelay
@@ -6579,14 +6579,14 @@ class gt extends X {
6579
6579
  return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
6580
6580
  }
6581
6581
  }
6582
- var q;
6582
+ var G;
6583
6583
  ((l) => {
6584
6584
  l.queue = new gt({
6585
6585
  duration: "client",
6586
6586
  processor: async function(a) {
6587
- if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session) {
6587
+ if (window.dispatchEvent(new CustomEvent(a.listener, { detail: a.data })), a.listener === "onEventReceived" && a.session && client instanceof q && window?.client && window?.client?.session) {
6588
6588
  const i = await l.generate.event.onSessionUpdate(
6589
- client.session,
6589
+ window?.client?.session,
6590
6590
  w.event.parseProvider(a.data)
6591
6591
  );
6592
6592
  window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: i }));
@@ -7252,7 +7252,7 @@ var q;
7252
7252
  var c = i?.name ?? w.random.array(A.names.filter((H) => H.length))[0], b = i?.message ?? w.random.array(A.messages.filter((H) => H.length))[0], p = await w.message.generateBadges(
7253
7253
  i?.badges ?? [],
7254
7254
  t
7255
- ), o = w.message.findEmotesInText(b), h = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), d = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), v = i?.channel ?? client.details.user.username;
7255
+ ), o = w.message.findEmotesInText(b), h = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), d = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), v = i?.channel ?? window?.client?.details?.user?.username ?? "local";
7256
7256
  return {
7257
7257
  listener: "message",
7258
7258
  event: {
@@ -7477,7 +7477,7 @@ var q;
7477
7477
  case "mute":
7478
7478
  case "unmute":
7479
7479
  case "alertService:toggleSound": {
7480
- var J = i?.muted ?? !client.details.overlay.muted;
7480
+ var J = i?.muted ?? window?.client?.details?.overlay?.muted ?? !1;
7481
7481
  return {
7482
7482
  listener: "alertService:toggleSound",
7483
7483
  event: {
@@ -7514,7 +7514,7 @@ var q;
7514
7514
  i?.badges ?? [],
7515
7515
  t
7516
7516
  );
7517
- var o = w.message.findEmotesInText(b), h = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), d = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), x = i?.avatar ?? w.random.array(A.avatars)[0], v = i?.channel ?? client.details.user.username;
7517
+ var o = w.message.findEmotesInText(b), h = w.message.replaceEmotesWithHTML(b, o), f = i?.color ?? w.random.color("hex"), d = i?.userId ?? w.random.number(1e7, 99999999).toString(), g = i?.msgId ?? w.random.uuid(), y = i?.time ?? Date.now(), x = i?.avatar ?? w.random.array(A.avatars)[0], v = i?.channel ?? window?.client?.details?.user?.username ?? "local";
7518
7518
  return {
7519
7519
  listener: "message",
7520
7520
  event: {
@@ -7835,7 +7835,7 @@ var q;
7835
7835
  });
7836
7836
  }
7837
7837
  l.start = e;
7838
- })(q || (q = {}));
7838
+ })(G || (G = {}));
7839
7839
  const rt = {
7840
7840
  getOverlayStatus: () => ({
7841
7841
  isEditorMode: !1,
@@ -7883,9 +7883,13 @@ var ot;
7883
7883
  })(e = l.Pronouns || (l.Pronouns = {}));
7884
7884
  async function t() {
7885
7885
  try {
7886
- const i = await fetch("https://pronouns.alejo.io/api/pronouns").then((s) => s.json());
7886
+ const i = await fetch("https://pronouns.alejo.io/api/pronouns").then(
7887
+ (s) => s.json()
7888
+ );
7887
7889
  if (Array.isArray(i) && i.length) {
7888
- const s = Object.fromEntries(i.map(({ name: n, display: m }) => [n, m]));
7890
+ const s = Object.fromEntries(
7891
+ i.map(({ name: n, display: m }) => [n, m])
7892
+ );
7889
7893
  return { ...e.map, ...s };
7890
7894
  }
7891
7895
  } catch {
@@ -7895,18 +7899,32 @@ var ot;
7895
7899
  l.list = t;
7896
7900
  async function a(i) {
7897
7901
  if (!i) throw new Error("Username is required to fetch Alejo data.");
7898
- if (i = i.toLowerCase(), i in client.storage.data.pronoun && client.storage.data.pronoun[i].expire > Date.now())
7899
- return client.storage.data.pronoun[i].value;
7902
+ if (i = i.toLowerCase(), !window?.client) {
7903
+ try {
7904
+ const s = await fetch(`https://pronouns.alejo.io/api/users/${i}`).then((n) => n.json()).then(([n]) => n);
7905
+ if (s)
7906
+ return s.pronoun_id;
7907
+ } catch (s) {
7908
+ throw new Error(
7909
+ `Failed to fetch pronoun data for user "${i}": ${s instanceof Error ? s.message : s}`
7910
+ );
7911
+ }
7912
+ return;
7913
+ }
7914
+ if (i in window?.client?.storage.data.pronoun && window?.client?.storage.data.pronoun[i].expire > Date.now())
7915
+ return window?.client?.storage.data.pronoun[i].value;
7900
7916
  try {
7901
7917
  const s = await fetch(`https://pronouns.alejo.io/api/users/${i}`).then((n) => n.json()).then(([n]) => n);
7902
7918
  if (s)
7903
- return client.storage.add(`pronoun.${i}`, {
7919
+ return window?.client?.storage.add(`pronoun.${i}`, {
7904
7920
  value: s.pronoun_id,
7905
7921
  timestamp: Date.now(),
7906
- expire: Date.now() + client.cache.pronoun * 60 * 1e3
7907
- }), client.storage.data.pronoun[i].value ?? s.pronoun_id;
7922
+ expire: Date.now() + window?.client?.cache.pronoun * 60 * 1e3
7923
+ }), window?.client?.storage.data.pronoun[i].value ?? s.pronoun_id;
7908
7924
  } catch (s) {
7909
- throw new Error(`Failed to fetch pronoun data for user "${i}": ${s instanceof Error ? s.message : s}`);
7925
+ throw new Error(
7926
+ `Failed to fetch pronoun data for user "${i}": ${s instanceof Error ? s.message : s}`
7927
+ );
7910
7928
  }
7911
7929
  }
7912
7930
  l.get = a;
@@ -7943,9 +7961,9 @@ class At extends X {
7943
7961
  */
7944
7962
  connect() {
7945
7963
  this.instance.onError = (e) => {
7946
- this.emit("error", e), client.debug && N.error("[Client]", "ComfyJS Error:", e);
7964
+ this.emit("error", e), client?.debug && N.error("[Client]", "ComfyJS Error:", e);
7947
7965
  }, this.instance.onCommand = (e, t, a, i, s) => {
7948
- if (this.emit("command", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
7966
+ if (this.emit("command", e, t, a, i, s), client?.debug && N.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
7949
7967
  const n = {
7950
7968
  ...i,
7951
7969
  broadcaster: i.broadcaster,
@@ -7963,10 +7981,10 @@ class At extends X {
7963
7981
  msgId: s.id,
7964
7982
  channel: s.channel
7965
7983
  };
7966
- q.emulate.twitch.message(m);
7984
+ G.emulate.twitch.message(m);
7967
7985
  }
7968
7986
  }, this.instance.onChat = (e, t, a, i, s) => {
7969
- if (this.emit("chat", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
7987
+ if (this.emit("chat", e, t, a, i, s), client?.debug && N.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
7970
7988
  const n = {
7971
7989
  ...a,
7972
7990
  ...s.userBadges,
@@ -7976,7 +7994,7 @@ class At extends X {
7976
7994
  subscriber: a.subscriber,
7977
7995
  founder: a.founder
7978
7996
  };
7979
- q.emulate.twitch.message({
7997
+ G.emulate.twitch.message({
7980
7998
  name: e,
7981
7999
  message: t,
7982
8000
  badges: Object.entries(n).map(([m, c]) => c ? m : null).filter(Boolean),
@@ -7988,24 +8006,24 @@ class At extends X {
7988
8006
  });
7989
8007
  }
7990
8008
  }, this.instance.onWhisper = (e, t, a, i, s) => {
7991
- this.emit("whisper", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
8009
+ this.emit("whisper", e, t, a, i, s), client?.debug && N.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
7992
8010
  }, this.instance.onMessageDeleted = (e, t) => {
7993
- this.emit("messageDeleted", e, t), client.debug && N.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && q.emulate.twitch.deleteMessage(e);
8011
+ this.emit("messageDeleted", e, t), client?.debug && N.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && G.emulate.twitch.deleteMessage(e);
7994
8012
  }, this.instance.onJoin = (e, t, a) => {
7995
- this.emit("join", e, t, a), client.debug && N.debug("[Client]", `ComfyJS Join: ${e}`);
8013
+ this.emit("join", e, t, a), client?.debug && N.debug("[Client]", `ComfyJS Join: ${e}`);
7996
8014
  }, this.instance.onPart = (e, t, a) => {
7997
- this.emit("part", e, t, a), client.debug && N.debug("[Client]", `ComfyJS Part: ${e}`);
8015
+ this.emit("part", e, t, a), client?.debug && N.debug("[Client]", `ComfyJS Part: ${e}`);
7998
8016
  }, this.instance.onHosted = (e, t, a, i) => {
7999
- this.emit("hosted", e, t, a, i), client.debug && N.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
8017
+ this.emit("hosted", e, t, a, i), client?.debug && N.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
8000
8018
  }, this.instance.onRaid = (e, t, a) => {
8001
- this.emit("raid", e, t, a), client.debug && N.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && q.emulate.twitch.raid({
8019
+ this.emit("raid", e, t, a), client?.debug && N.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && G.emulate.twitch.raid({
8002
8020
  name: e,
8003
8021
  amount: t
8004
8022
  });
8005
8023
  }, this.instance.onSub = (e, t, a, i) => {
8006
- if (this.emit("sub", e, t, a, i), client.debug && N.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
8024
+ if (this.emit("sub", e, t, a, i), client?.debug && N.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
8007
8025
  const s = a.plan === "Prime" ? "prime" : a.plan;
8008
- q.emulate.twitch.subscriber({
8026
+ G.emulate.twitch.subscriber({
8009
8027
  name: e,
8010
8028
  message: t,
8011
8029
  tier: s,
@@ -8013,9 +8031,9 @@ class At extends X {
8013
8031
  });
8014
8032
  }
8015
8033
  }, this.instance.onResub = (e, t, a, i, s, n) => {
8016
- if (this.emit("resub", e, t, a, i, s, n), client.debug && N.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
8034
+ if (this.emit("resub", e, t, a, i, s, n), client?.debug && N.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
8017
8035
  const m = s.plan === "Prime" ? "prime" : s.plan;
8018
- q.emulate.twitch.subscriber({
8036
+ G.emulate.twitch.subscriber({
8019
8037
  name: e,
8020
8038
  message: t,
8021
8039
  tier: m,
@@ -8032,9 +8050,9 @@ class At extends X {
8032
8050
  i,
8033
8051
  s,
8034
8052
  n
8035
- ), client.debug && N.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
8053
+ ), client?.debug && N.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
8036
8054
  const m = s.plan === "Prime" ? "prime" : s.plan;
8037
- q.emulate.twitch.subscriber({
8055
+ G.emulate.twitch.subscriber({
8038
8056
  name: a,
8039
8057
  message: "",
8040
8058
  sender: e,
@@ -8044,12 +8062,12 @@ class At extends X {
8044
8062
  });
8045
8063
  }
8046
8064
  }, this.instance.onSubMysteryGift = (e, t, a, i, s) => {
8047
- if (this.emit("subMysteryGift", e, t, a, i, s), client.debug && N.debug(
8065
+ if (this.emit("subMysteryGift", e, t, a, i, s), client?.debug && N.debug(
8048
8066
  "[Client]",
8049
8067
  `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`
8050
8068
  ), this.emulate) {
8051
8069
  const n = i.plan === "Prime" ? "prime" : i.plan;
8052
- q.emulate.twitch.subscriber({
8070
+ G.emulate.twitch.subscriber({
8053
8071
  name: e,
8054
8072
  message: "",
8055
8073
  amount: t,
@@ -8058,10 +8076,10 @@ class At extends X {
8058
8076
  });
8059
8077
  }
8060
8078
  }, this.instance.onGiftSubContinue = (e, t, a) => {
8061
- this.emit("giftSubContinue", e, t, a), client.debug && N.debug(
8079
+ this.emit("giftSubContinue", e, t, a), client?.debug && N.debug(
8062
8080
  "[Client]",
8063
8081
  `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`
8064
- ), this.emulate && q.emulate.twitch.subscriber({
8082
+ ), this.emulate && G.emulate.twitch.subscriber({
8065
8083
  name: e,
8066
8084
  message: "",
8067
8085
  sender: t,
@@ -8069,25 +8087,25 @@ class At extends X {
8069
8087
  subType: "gift"
8070
8088
  });
8071
8089
  }, this.instance.onCheer = (e, t, a, i, s) => {
8072
- this.emit("cheer", e, t, a, i, s), client.debug && N.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && q.emulate.twitch.cheer({
8090
+ this.emit("cheer", e, t, a, i, s), client?.debug && N.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && G.emulate.twitch.cheer({
8073
8091
  name: e,
8074
8092
  message: t,
8075
8093
  amount: a
8076
8094
  });
8077
8095
  }, this.instance.onChatMode = (e, t) => {
8078
- this.emit("chatMode", e, t), client.debug && N.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
8096
+ this.emit("chatMode", e, t), client?.debug && N.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
8079
8097
  }, this.instance.onReward = (e, t, a, i, s) => {
8080
- this.emit("reward", e, t, a, i, s), client.debug && N.debug(
8098
+ this.emit("reward", e, t, a, i, s), client?.debug && N.debug(
8081
8099
  "[Client]",
8082
8100
  `ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`
8083
8101
  );
8084
8102
  }, this.instance.onConnected = (e, t, a) => {
8085
- this.emit("connected", e, t, a), client.debug && N.debug(
8103
+ this.emit("connected", e, t, a), client?.debug && N.debug(
8086
8104
  "[Client]",
8087
8105
  `ComfyJS Connected: ${e}:${t} (First Connect: ${a})`
8088
8106
  );
8089
8107
  }, this.instance.onReconnect = (e) => {
8090
- this.emit("reconnect", e), client.debug && N.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
8108
+ this.emit("reconnect", e), client?.debug && N.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
8091
8109
  }, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
8092
8110
  }
8093
8111
  }
@@ -8192,9 +8210,9 @@ class pt {
8192
8210
  }
8193
8211
  const ct = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(Dt()), N = new pt(), mt = {
8194
8212
  SeAPI: ct,
8195
- Client: G,
8213
+ Client: q,
8196
8214
  Helper: w,
8197
- Local: q,
8215
+ Local: G,
8198
8216
  Data: A,
8199
8217
  logger: N,
8200
8218
  modules: {