@tixyel/streamelements 7.3.0 → 7.4.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.d.ts +155 -146
- package/dist/index.es.js +868 -827
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -9492,7 +9492,7 @@ var T = class {
|
|
|
9492
9492
|
}
|
|
9493
9493
|
}, D = class {
|
|
9494
9494
|
parseProvider(e, t) {
|
|
9495
|
-
var n =
|
|
9495
|
+
var n = e?.provider || e.event?.provider || e.event?.service || e.event?.data?.provider || t || window?.client?.details?.provider || "twitch";
|
|
9496
9496
|
return [
|
|
9497
9497
|
"kvstore:update",
|
|
9498
9498
|
"bot:counter",
|
|
@@ -9595,7 +9595,7 @@ function j(e, t, n) {
|
|
|
9595
9595
|
b: Math.round(a * 255)
|
|
9596
9596
|
};
|
|
9597
9597
|
}
|
|
9598
|
-
async function
|
|
9598
|
+
async function M(e, t, n) {
|
|
9599
9599
|
let r = l, i = r[0], a = Infinity;
|
|
9600
9600
|
for await (let o of r) {
|
|
9601
9601
|
let r = document.createElement("canvas");
|
|
@@ -9610,7 +9610,7 @@ async function ee(e, t, n) {
|
|
|
9610
9610
|
}
|
|
9611
9611
|
//#endregion
|
|
9612
9612
|
//#region src/helper/classes/color.ts
|
|
9613
|
-
var
|
|
9613
|
+
var N = class {
|
|
9614
9614
|
opacity(e = 100, t = "") {
|
|
9615
9615
|
t = t.length > 7 ? t?.substring(0, 6) : t, e = e > 1 ? e / 100 : e;
|
|
9616
9616
|
let n = Math.round(Math.min(Math.max(e, 0), 1) * 255).toString(16).toLowerCase().padStart(2, "0");
|
|
@@ -9650,11 +9650,11 @@ var M = class {
|
|
|
9650
9650
|
let e = A(r.r, r.g, r.b);
|
|
9651
9651
|
return `hsla(${e.h}, ${e.s}%, ${e.l}%, ${r.a})`;
|
|
9652
9652
|
}
|
|
9653
|
-
case "css-color-name": return await
|
|
9653
|
+
case "css-color-name": return await M(r.r, r.g, r.b);
|
|
9654
9654
|
default: return null;
|
|
9655
9655
|
}
|
|
9656
9656
|
}
|
|
9657
|
-
},
|
|
9657
|
+
}, ee = class {
|
|
9658
9658
|
constructor() {
|
|
9659
9659
|
this.PRESETS = {};
|
|
9660
9660
|
}
|
|
@@ -9876,7 +9876,7 @@ var M = class {
|
|
|
9876
9876
|
}
|
|
9877
9877
|
return r ? !a : a;
|
|
9878
9878
|
}
|
|
9879
|
-
let T = new
|
|
9879
|
+
let T = new N(), E = {
|
|
9880
9880
|
BT1: (e) => p > 1 ? e : "",
|
|
9881
9881
|
BT0: (e) => p > 0 ? e : "",
|
|
9882
9882
|
ST1: (e) => p < 1 ? e : "",
|
|
@@ -10100,7 +10100,7 @@ var M = class {
|
|
|
10100
10100
|
let j = e.replace(f.PLACEHOLDERS, (e, t) => typeof d[t] == "string" || typeof d[t] == "number" ? String(d[t]) : t ?? t);
|
|
10101
10101
|
return j = n.method === "loop" ? k(j) : A(j), j;
|
|
10102
10102
|
}
|
|
10103
|
-
},
|
|
10103
|
+
}, te = class {
|
|
10104
10104
|
constructor() {
|
|
10105
10105
|
this.playing = !1;
|
|
10106
10106
|
}
|
|
@@ -10119,18 +10119,18 @@ var M = class {
|
|
|
10119
10119
|
throw Error(`Error playing sound: ${e}`);
|
|
10120
10120
|
}
|
|
10121
10121
|
}
|
|
10122
|
-
},
|
|
10122
|
+
}, ne = class {
|
|
10123
10123
|
apply(e, t, n) {
|
|
10124
10124
|
return e.apply(t, n);
|
|
10125
10125
|
}
|
|
10126
10126
|
call(e, t, ...n) {
|
|
10127
10127
|
return e.call(t, ...n);
|
|
10128
10128
|
}
|
|
10129
|
-
},
|
|
10129
|
+
}, re = class {
|
|
10130
10130
|
constructor(e, t, n = [], r = !1, i) {
|
|
10131
10131
|
this.badges = [], this.isSubscriber = !1, this.id = e, this.name = t, this.login = t.toLocaleLowerCase(), this.badges = n, this.isSubscriber = r, this.tier = i;
|
|
10132
10132
|
}
|
|
10133
|
-
},
|
|
10133
|
+
}, ie = {
|
|
10134
10134
|
broadcaster: [
|
|
10135
10135
|
"moderator",
|
|
10136
10136
|
"vip",
|
|
@@ -10147,12 +10147,12 @@ var M = class {
|
|
|
10147
10147
|
"duelyst_6",
|
|
10148
10148
|
"duelyst_7"
|
|
10149
10149
|
]
|
|
10150
|
-
},
|
|
10150
|
+
}, P = [], ae = class t extends e {
|
|
10151
10151
|
static fixUser(e) {
|
|
10152
10152
|
return typeof e == "string" ? e.trim().replace(/^@+/, "").toLocaleLowerCase() : t.fixUser(e.name);
|
|
10153
10153
|
}
|
|
10154
10154
|
static getRandomSubTier() {
|
|
10155
|
-
return new
|
|
10155
|
+
return new F().probability({
|
|
10156
10156
|
prime: .4,
|
|
10157
10157
|
1e3: .3,
|
|
10158
10158
|
2e3: .2,
|
|
@@ -10166,7 +10166,7 @@ var M = class {
|
|
|
10166
10166
|
e.set(n, [...r, t]);
|
|
10167
10167
|
}
|
|
10168
10168
|
return e;
|
|
10169
|
-
}, /* @__PURE__ */ new Map())),
|
|
10169
|
+
}, /* @__PURE__ */ new Map())), P.push(this);
|
|
10170
10170
|
}
|
|
10171
10171
|
start(e, n = w.badges.map((e) => e.set_id), r) {
|
|
10172
10172
|
let i = e.map((e) => e && t.fixUser(e)).filter((e) => e && e.length).filter((e, t, n) => n.indexOf(e) === t), a = n.filter((e, t, n) => n.indexOf(e) === t);
|
|
@@ -10212,7 +10212,7 @@ var M = class {
|
|
|
10212
10212
|
}
|
|
10213
10213
|
return null;
|
|
10214
10214
|
};
|
|
10215
|
-
for (let [e, t] of S(
|
|
10215
|
+
for (let [e, t] of S(ie, r?.incompatible)) if (d.has(e)) for (let n of x(t)) d.has(n) && C(e, n);
|
|
10216
10216
|
for (let e of a) {
|
|
10217
10217
|
let t = b(u[e]);
|
|
10218
10218
|
for (let n of t) {
|
|
@@ -10258,7 +10258,7 @@ var M = class {
|
|
|
10258
10258
|
continue;
|
|
10259
10259
|
}
|
|
10260
10260
|
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
10261
|
-
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new
|
|
10261
|
+
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new re(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
|
|
10262
10262
|
o.push(s);
|
|
10263
10263
|
}
|
|
10264
10264
|
return o.length < i.length && this.emit("warn", /* @__PURE__ */ Error("Some users could not be assigned badges due to limits. Consider increasing limits or adding more badges.")), o;
|
|
@@ -10313,7 +10313,7 @@ var M = class {
|
|
|
10313
10313
|
message: new T().array(e)[0]
|
|
10314
10314
|
};
|
|
10315
10315
|
}
|
|
10316
|
-
},
|
|
10316
|
+
}, F = class e {
|
|
10317
10317
|
delay(e, t) {
|
|
10318
10318
|
return new Promise((n) => setTimeout(() => {
|
|
10319
10319
|
n(t ? t() ?? null : null);
|
|
@@ -10367,7 +10367,7 @@ var M = class {
|
|
|
10367
10367
|
async findSubscriptionTier({ userId: e, name: t, broadcasterId: n }, r, i = !1) {
|
|
10368
10368
|
let a = (e) => e === "prime" || e === "1000" || e === 1e3 || e === 1 || e === "1" ? 1 : e === "2000" || e === 2e3 || e === 2 || e === "2" ? 2 : e === "3000" || e === 3e3 || e === 3 || e === "3" ? 3 : 1;
|
|
10369
10369
|
if (e?.includes("fake_user_")) {
|
|
10370
|
-
let t =
|
|
10370
|
+
let t = P.find((t) => e.endsWith(`+${t.id}`));
|
|
10371
10371
|
if (t) {
|
|
10372
10372
|
let n = t.getById(e);
|
|
10373
10373
|
if (n) return a(n.tier);
|
|
@@ -10509,7 +10509,7 @@ var M = class {
|
|
|
10509
10509
|
}
|
|
10510
10510
|
}
|
|
10511
10511
|
}
|
|
10512
|
-
},
|
|
10512
|
+
}, oe = class {
|
|
10513
10513
|
lerp(e, t, n) {
|
|
10514
10514
|
let r = Math.max(0, Math.min(1, n));
|
|
10515
10515
|
return e + (t - e) * r;
|
|
@@ -10605,30 +10605,30 @@ var M = class {
|
|
|
10605
10605
|
y: r
|
|
10606
10606
|
};
|
|
10607
10607
|
}
|
|
10608
|
-
},
|
|
10608
|
+
}, I;
|
|
10609
10609
|
(function(e) {
|
|
10610
|
-
e.animate = new
|
|
10611
|
-
})(
|
|
10610
|
+
e.animate = new oe(), e.number = new i(), e.element = new a(), e.object = new o(), e.message = new E(), e.event = new D(), e.string = new ee(), e.sound = new te(), e.color = new N(), e.random = new T(), e.fn = new ne(), e.utils = new F();
|
|
10611
|
+
})(I ||= {});
|
|
10612
10612
|
//#endregion
|
|
10613
10613
|
//#region src/actions/button.ts
|
|
10614
|
-
var
|
|
10614
|
+
var L = [], R = class e {
|
|
10615
10615
|
constructor(e) {
|
|
10616
|
-
this.field = "button", this.template = "button", this.name = "Button", this.value = "", 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,
|
|
10616
|
+
this.field = "button", this.template = "button", this.name = "Button", this.value = "", 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, L.push(this), window?.client instanceof r && (window?.client?.actions.buttons.push(this), window?.client?.emit("action", this, "created"));
|
|
10617
10617
|
}
|
|
10618
10618
|
generate(e) {
|
|
10619
|
-
return
|
|
10620
|
-
let r =
|
|
10619
|
+
return I.utils.typedValues(e).reduce((e, t, n) => {
|
|
10620
|
+
let r = I.string.compose(this.template, {
|
|
10621
10621
|
index: n,
|
|
10622
10622
|
...t
|
|
10623
10623
|
}, { html: !1 });
|
|
10624
10624
|
e[r] = {
|
|
10625
10625
|
type: "button",
|
|
10626
|
-
label:
|
|
10626
|
+
label: I.string.compose(this.name, {
|
|
10627
10627
|
index: n,
|
|
10628
10628
|
...t
|
|
10629
10629
|
}, { html: !1 })
|
|
10630
10630
|
};
|
|
10631
|
-
let i =
|
|
10631
|
+
let i = I.string.compose(String(this.value), {
|
|
10632
10632
|
index: n,
|
|
10633
10633
|
...t
|
|
10634
10634
|
}, { html: !1 });
|
|
@@ -10645,15 +10645,15 @@ var V = [], H = class e {
|
|
|
10645
10645
|
return this;
|
|
10646
10646
|
}
|
|
10647
10647
|
remove() {
|
|
10648
|
-
let e =
|
|
10649
|
-
if (e > -1 &&
|
|
10648
|
+
let e = L.indexOf(this);
|
|
10649
|
+
if (e > -1 && L.splice(e, 1), !(window?.client instanceof r)) return;
|
|
10650
10650
|
let t = window?.client.actions.buttons.indexOf(this);
|
|
10651
10651
|
t > -1 && (window?.client?.actions.buttons.splice(t, 1), window?.client?.emit("action", this, "removed"));
|
|
10652
10652
|
}
|
|
10653
10653
|
static execute(t, n) {
|
|
10654
10654
|
try {
|
|
10655
|
-
if (
|
|
10656
|
-
let r =
|
|
10655
|
+
if (L.length) {
|
|
10656
|
+
let r = L.filter((e) => typeof e.field == "string" ? e.field === t : typeof e.field == "function" ? e.field(t, n) : !1);
|
|
10657
10657
|
if (r.length && r.every((t) => t instanceof e)) return r.forEach((e) => {
|
|
10658
10658
|
try {
|
|
10659
10659
|
e.parse(t, n), window?.client?.emit("action", e, "executed"), Q.received(`Button executed: ${t}${n ? ` with value: ${n}` : ""}`);
|
|
@@ -10668,9 +10668,9 @@ var V = [], H = class e {
|
|
|
10668
10668
|
return !1;
|
|
10669
10669
|
}
|
|
10670
10670
|
}
|
|
10671
|
-
},
|
|
10671
|
+
}, z = [], B = class e {
|
|
10672
10672
|
constructor(e) {
|
|
10673
|
-
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,
|
|
10673
|
+
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, z.push(this), window?.client instanceof r && (window?.client?.actions.commands.push(this), window?.client?.emit("action", this, "created"));
|
|
10674
10674
|
}
|
|
10675
10675
|
run(e, t) {}
|
|
10676
10676
|
verify(e, t, n) {
|
|
@@ -10705,16 +10705,16 @@ var V = [], H = class e {
|
|
|
10705
10705
|
return o === !0 && this.run.apply(window?.client || void 0, [n, t]), o;
|
|
10706
10706
|
}
|
|
10707
10707
|
remove() {
|
|
10708
|
-
let e =
|
|
10709
|
-
if (e > -1 &&
|
|
10708
|
+
let e = z.indexOf(this);
|
|
10709
|
+
if (e > -1 && z.splice(e, 1), !(window?.client instanceof r)) return;
|
|
10710
10710
|
let t = window?.client?.actions.commands.indexOf(this);
|
|
10711
10711
|
t > -1 && (window?.client?.actions.commands.splice(t, 1), window?.client?.emit("action", this, "removed"));
|
|
10712
10712
|
}
|
|
10713
10713
|
static execute(t) {
|
|
10714
10714
|
let n = t.data;
|
|
10715
10715
|
try {
|
|
10716
|
-
if (
|
|
10717
|
-
let r =
|
|
10716
|
+
if (z.length && z.some((e) => n.event.data.text.startsWith(e.prefix))) {
|
|
10717
|
+
let r = z.filter((e) => {
|
|
10718
10718
|
var t = [e.name, ...e.aliases ?? []], r = n.event.data.text.replace(e.prefix, "").split(" ")[0];
|
|
10719
10719
|
return t.includes(r);
|
|
10720
10720
|
});
|
|
@@ -10728,9 +10728,9 @@ var V = [], H = class e {
|
|
|
10728
10728
|
return !1;
|
|
10729
10729
|
}
|
|
10730
10730
|
}
|
|
10731
|
-
},
|
|
10731
|
+
}, V = [], se = class extends e {
|
|
10732
10732
|
constructor(e = {}) {
|
|
10733
|
-
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id,
|
|
10733
|
+
super(), this.SE_API = null, this.id = "widget communications", this.loaded = !1, this.history = [], this.detected = /* @__PURE__ */ new Set(), this.id = e.id || this.id, V.push(this), Z?.then(async (e) => {
|
|
10734
10734
|
this.loaded = !0, this.SE_API = e, Promise.all([async () => {
|
|
10735
10735
|
let t = await e.store.get(this.id);
|
|
10736
10736
|
t && (this.history = t.slice(-10));
|
|
@@ -10811,7 +10811,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10811
10811
|
}
|
|
10812
10812
|
}), window.addEventListener("onEventReceived", ({ detail: e }) => {
|
|
10813
10813
|
if (window.client instanceof r && client instanceof r && client) {
|
|
10814
|
-
let r =
|
|
10814
|
+
let r = I.event.parseProvider(e);
|
|
10815
10815
|
switch (r.provider) {
|
|
10816
10816
|
case "streamelements": {
|
|
10817
10817
|
let e = r.data;
|
|
@@ -10826,7 +10826,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10826
10826
|
switch (e.event.listener) {
|
|
10827
10827
|
case "widget-button": {
|
|
10828
10828
|
let t = e.event;
|
|
10829
|
-
|
|
10829
|
+
R.execute(t.field, t.value);
|
|
10830
10830
|
break;
|
|
10831
10831
|
}
|
|
10832
10832
|
case "subscriber-latest":
|
|
@@ -10840,8 +10840,8 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10840
10840
|
var n = t.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
|
|
10841
10841
|
n && n.update(r.data.value);
|
|
10842
10842
|
}
|
|
10843
|
-
if (
|
|
10844
|
-
let e =
|
|
10843
|
+
if (V.length) {
|
|
10844
|
+
let e = V.find((e) => e.id === r.data.key.replace("customWidget.", "") || e.id === r.data.key);
|
|
10845
10845
|
e && e.update(r.data.value);
|
|
10846
10846
|
}
|
|
10847
10847
|
break;
|
|
@@ -10868,7 +10868,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10868
10868
|
e.event;
|
|
10869
10869
|
break;
|
|
10870
10870
|
case "message":
|
|
10871
|
-
e.event,
|
|
10871
|
+
e.event, B.execute({
|
|
10872
10872
|
provider: "twitch",
|
|
10873
10873
|
data: e
|
|
10874
10874
|
});
|
|
@@ -10893,7 +10893,7 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10893
10893
|
let e = r.data;
|
|
10894
10894
|
switch (e.listener) {
|
|
10895
10895
|
case "message":
|
|
10896
|
-
e.event,
|
|
10896
|
+
e.event, B.execute({
|
|
10897
10897
|
provider: "youtube",
|
|
10898
10898
|
data: e
|
|
10899
10899
|
});
|
|
@@ -10929,90 +10929,678 @@ window.addEventListener("onWidgetLoad", async (e) => {
|
|
|
10929
10929
|
}
|
|
10930
10930
|
});
|
|
10931
10931
|
//#endregion
|
|
10932
|
-
//#region src/
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10932
|
+
//#region src/local/generator.ts
|
|
10933
|
+
async function ce(e, t, n = "USD") {
|
|
10934
|
+
let r = {
|
|
10935
|
+
BRL: {
|
|
10936
|
+
code: "BRL",
|
|
10937
|
+
name: "Brazilian Real",
|
|
10938
|
+
symbol: "R$"
|
|
10939
|
+
},
|
|
10940
|
+
USD: {
|
|
10941
|
+
code: "USD",
|
|
10942
|
+
name: "US Dollar",
|
|
10943
|
+
symbol: "$"
|
|
10944
|
+
},
|
|
10945
|
+
EUR: {
|
|
10946
|
+
code: "EUR",
|
|
10947
|
+
name: "Euro",
|
|
10948
|
+
symbol: "€"
|
|
10942
10949
|
}
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
}
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10950
|
+
};
|
|
10951
|
+
return {
|
|
10952
|
+
channel: {
|
|
10953
|
+
username: "local",
|
|
10954
|
+
apiToken: "",
|
|
10955
|
+
id: "",
|
|
10956
|
+
providerId: "",
|
|
10957
|
+
avatar: ""
|
|
10958
|
+
},
|
|
10959
|
+
currency: r[n] ?? r.USD,
|
|
10960
|
+
fieldData: e,
|
|
10961
|
+
recents: [],
|
|
10962
|
+
session: {
|
|
10963
|
+
data: t,
|
|
10964
|
+
settings: {
|
|
10965
|
+
autoReset: !1,
|
|
10966
|
+
calendar: !1,
|
|
10967
|
+
resetOnStart: !1
|
|
10968
|
+
}
|
|
10969
|
+
},
|
|
10970
|
+
overlay: {
|
|
10971
|
+
isEditorMode: !0,
|
|
10972
|
+
muted: !1
|
|
10973
|
+
},
|
|
10974
|
+
emulated: !0
|
|
10975
|
+
};
|
|
10976
|
+
}
|
|
10977
|
+
async function le(e, t) {
|
|
10978
|
+
if (e ??= await U.session.get(), t) {
|
|
10979
|
+
let n = (e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime();
|
|
10980
|
+
switch (t.provider) {
|
|
10981
|
+
case "twitch": {
|
|
10982
|
+
let r = t.data;
|
|
10983
|
+
switch (r.listener) {
|
|
10984
|
+
case "cheer-latest": {
|
|
10985
|
+
let t = r.event.amount, i = r.event.displayName ?? r.event.name, a = r.event.message;
|
|
10986
|
+
e["cheer-latest"] = {
|
|
10987
|
+
name: i,
|
|
10988
|
+
amount: t,
|
|
10989
|
+
message: a
|
|
10990
|
+
};
|
|
10991
|
+
let o = (n) => {
|
|
10992
|
+
if (n === "all") {
|
|
10993
|
+
o("alltime"), o("monthly"), o("weekly"), o("session");
|
|
10994
|
+
return;
|
|
10995
|
+
}
|
|
10996
|
+
let r = e[`cheer-${n}-top-donation`];
|
|
10997
|
+
r && t > r.amount && (r.amount = t, r.name = i);
|
|
10998
|
+
let a = e[`cheer-${n}-top-donator`], s = e["cheer-recent"].filter((e) => e.name.toLowerCase() === a.name.toLowerCase()).reduce((e, t) => e + t.amount, 0), c = e["cheer-recent"].filter((e) => e.name.toLowerCase() === i.toLowerCase()).reduce((e, t) => e + t.amount, 0);
|
|
10999
|
+
c > s && (a.amount = c, a.name = i);
|
|
11000
|
+
};
|
|
11001
|
+
o("all"), e["cheer-session"].amount += t, e["cheer-week"].amount += t, e["cheer-month"].amount += t, e["cheer-total"].amount += t, e["cheer-count"].count += 1, e["cheer-goal"].amount += t, e["cheer-recent"].unshift({
|
|
11002
|
+
name: i,
|
|
11003
|
+
amount: t,
|
|
11004
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11005
|
+
}), e["cheer-recent"] = (e["cheer-recent"] || []).sort(n);
|
|
11006
|
+
break;
|
|
11007
|
+
}
|
|
11008
|
+
case "follower-latest": {
|
|
11009
|
+
let t = r.event.displayName ?? r.event.name;
|
|
11010
|
+
e["follower-latest"].name = t, e["follower-session"].count += 1, e["follower-week"].count += 1, e["follower-month"].count += 1, e["follower-total"].count += 1, e["follower-goal"].amount += 1, e["follower-recent"].unshift({
|
|
11011
|
+
name: t,
|
|
11012
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11013
|
+
}), e["follower-recent"] = (e["follower-recent"] || []).sort(n);
|
|
11014
|
+
break;
|
|
11015
|
+
}
|
|
11016
|
+
case "subscriber-latest": {
|
|
11017
|
+
let t = r.event.displayName ?? r.event.name, i = r.event.amount, a = r.event.tier, o = r.event.message;
|
|
11018
|
+
if (e["subscriber-latest"] = {
|
|
11019
|
+
name: t,
|
|
11020
|
+
amount: i,
|
|
11021
|
+
tier: a,
|
|
11022
|
+
message: o ?? ""
|
|
11023
|
+
}, e["subscriber-recent"].find((e) => e.name.toLowerCase() === t.toLowerCase()) ? i > 1 && (e["subscriber-resub-latest"] = {
|
|
11024
|
+
name: t,
|
|
11025
|
+
amount: i,
|
|
11026
|
+
message: o ?? ""
|
|
11027
|
+
}, e["subscriber-resub-session"].count += 1) : (e["subscriber-new-latest"] = {
|
|
11028
|
+
name: t,
|
|
11029
|
+
amount: i,
|
|
11030
|
+
message: o ?? ""
|
|
11031
|
+
}, e["subscriber-new-session"].count += 1), !(!r.event.gifted && !r.event.bulkGifted && !r.event.isCommunityGift)) if (r.event.gifted && !r.event.bulkGifted && !r.event.isCommunityGift) {
|
|
11032
|
+
let n = r.event.sender;
|
|
11033
|
+
e["subscriber-gifted-latest"] = {
|
|
11034
|
+
name: t,
|
|
11035
|
+
amount: i,
|
|
11036
|
+
tier: a,
|
|
11037
|
+
message: o ?? "",
|
|
11038
|
+
sender: n
|
|
11039
|
+
}, e["subscriber-gifted-session"].count += 1, e["subscriber-alltime-gifter"] = {
|
|
11040
|
+
name: n,
|
|
11041
|
+
amount: i
|
|
11042
|
+
};
|
|
11043
|
+
} else r.event.gifted && !r.event.bulkGifted && r.event.isCommunityGift || !r.event.gifted && r.event.bulkGifted && r.event.isCommunityGift;
|
|
11044
|
+
e["subscriber-session"].count += i, e["subscriber-week"].count += i, e["subscriber-month"].count += i, e["subscriber-total"].count += i, e["subscriber-goal"].amount += i, e["subscriber-points"].amount += i, e["subscriber-recent"].unshift({
|
|
11045
|
+
name: t,
|
|
11046
|
+
amount: i,
|
|
11047
|
+
tier: a,
|
|
11048
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11049
|
+
}), e["subscriber-recent"] = (e["subscriber-recent"] || []).sort(n);
|
|
11050
|
+
break;
|
|
11051
|
+
}
|
|
11052
|
+
case "raid-latest": {
|
|
11053
|
+
let t = r.event.displayName ?? r.event.name, i = r.event.amount;
|
|
11054
|
+
e["raid-latest"] = {
|
|
11055
|
+
name: t,
|
|
11056
|
+
amount: i
|
|
11057
|
+
}, e["raid-recent"].unshift({
|
|
11058
|
+
name: t,
|
|
11059
|
+
amount: i,
|
|
11060
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11061
|
+
}), e["raid-recent"] = (e["raid-recent"] || []).sort(n);
|
|
11062
|
+
break;
|
|
11063
|
+
}
|
|
11064
|
+
}
|
|
11065
|
+
break;
|
|
11066
|
+
}
|
|
11067
|
+
case "youtube": {
|
|
11068
|
+
let n = t.data;
|
|
11069
|
+
switch (n.listener) {
|
|
11070
|
+
case "superchat-latest": {
|
|
11071
|
+
let t = n.event.displayName ?? n.event.name, r = n.event.amount;
|
|
11072
|
+
e["superchat-latest"] = {
|
|
11073
|
+
name: t.toLowerCase(),
|
|
11074
|
+
displayName: t,
|
|
11075
|
+
amount: r,
|
|
11076
|
+
_id: I.random.uuid(),
|
|
11077
|
+
sessionTop: !1,
|
|
11078
|
+
type: "superchat",
|
|
11079
|
+
originalEventName: "superchat-latest",
|
|
11080
|
+
providerId: "",
|
|
11081
|
+
avatar: ""
|
|
11082
|
+
};
|
|
11083
|
+
let i = (n) => {
|
|
11084
|
+
if (n === "all") {
|
|
11085
|
+
i("alltime"), i("monthly"), i("weekly"), i("session");
|
|
11086
|
+
return;
|
|
11087
|
+
}
|
|
11088
|
+
let a = e[`superchat-${n}-top-donation`];
|
|
11089
|
+
a && r > a.amount && (a.amount = r, a.name = t);
|
|
11090
|
+
let o = e[`superchat-${n}-top-donator`], s = e["superchat-recent"].filter((e) => e.name.toLowerCase() === o.name.toLowerCase()).reduce((e, t) => e + t.amount, 0), c = e["superchat-recent"].filter((e) => e.name.toLowerCase() === t.toLowerCase()).reduce((e, t) => e + t.amount, 0);
|
|
11091
|
+
c > s && (o.amount = c, o.name = t);
|
|
11092
|
+
};
|
|
11093
|
+
i("all"), e["superchat-session"].amount += r, e["superchat-week"].amount += r, e["superchat-month"].amount += r, e["superchat-total"].amount += r, e["superchat-count"].count += 1, e["superchat-goal"].amount += r, e["superchat-recent"].unshift({
|
|
11094
|
+
name: t.toLowerCase(),
|
|
11095
|
+
displayName: t,
|
|
11096
|
+
amount: r,
|
|
11097
|
+
_id: I.random.uuid(),
|
|
11098
|
+
sessionTop: !1,
|
|
11099
|
+
type: "superchat",
|
|
11100
|
+
originalEventName: "superchat-latest",
|
|
11101
|
+
avatar: "",
|
|
11102
|
+
providerId: ""
|
|
11103
|
+
});
|
|
11104
|
+
break;
|
|
11105
|
+
}
|
|
11106
|
+
}
|
|
11107
|
+
break;
|
|
11108
|
+
}
|
|
11109
|
+
case "streamelements": {
|
|
11110
|
+
let r = t.data;
|
|
11111
|
+
switch (r.listener) {
|
|
11112
|
+
case "tip-latest": {
|
|
11113
|
+
let t = r.event.displayName ?? r.event.name, i = r.event.amount;
|
|
11114
|
+
e["tip-latest"] = {
|
|
11115
|
+
name: t,
|
|
11116
|
+
amount: i
|
|
11117
|
+
};
|
|
11118
|
+
let a = (n) => {
|
|
11119
|
+
if (n === "all") {
|
|
11120
|
+
a("alltime"), a("monthly"), a("weekly"), a("session");
|
|
11121
|
+
return;
|
|
11122
|
+
}
|
|
11123
|
+
let r = e[`tip-${n}-top-donation`];
|
|
11124
|
+
r && i > r.amount && (r.amount = i, r.name = t);
|
|
11125
|
+
let o = e[`tip-${n}-top-donator`], s = e["tip-recent"].filter((e) => e.name.toLowerCase() === o.name.toLowerCase()).reduce((e, t) => e + t.amount, 0), c = e["tip-recent"].filter((e) => e.name.toLowerCase() === t.toLowerCase()).reduce((e, t) => e + t.amount, 0);
|
|
11126
|
+
c > s && (o.amount = c, o.name = t);
|
|
11127
|
+
};
|
|
11128
|
+
a("all"), e["tip-session"].amount += i, e["tip-week"].amount += i, e["tip-month"].amount += i, e["tip-total"].amount += i, e["tip-count"].count += 1, e["tip-goal"].amount += i, e["tip-recent"].unshift({
|
|
11129
|
+
name: t,
|
|
11130
|
+
amount: i,
|
|
11131
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11132
|
+
}), e["tip-recent"] = (e["tip-recent"] || []).sort(n);
|
|
11133
|
+
break;
|
|
11134
|
+
}
|
|
11135
|
+
case "event:test": break;
|
|
11136
|
+
}
|
|
11137
|
+
break;
|
|
11138
|
+
}
|
|
10971
11139
|
}
|
|
10972
|
-
this.running = !0, await this.next(), typeof this.duration == "number" && this.duration > 0 ? this.timeouts.push(setTimeout(() => this.run(), this.duration)) : (this.duration === 0 || this.duration !== -1 && this.duration !== !1) && this.run();
|
|
10973
11140
|
}
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
11141
|
+
return {
|
|
11142
|
+
session: e,
|
|
11143
|
+
emulated: !0
|
|
11144
|
+
};
|
|
11145
|
+
}
|
|
11146
|
+
async function H(e = "random", t = "random", n = {}) {
|
|
11147
|
+
let r = {
|
|
11148
|
+
twitch: [
|
|
11149
|
+
"message",
|
|
11150
|
+
"follower-latest",
|
|
11151
|
+
"cheer-latest",
|
|
11152
|
+
"raid-latest",
|
|
11153
|
+
"subscriber-latest"
|
|
11154
|
+
],
|
|
11155
|
+
streamelements: ["tip-latest"],
|
|
11156
|
+
youtube: [
|
|
11157
|
+
"message",
|
|
11158
|
+
"superchat-latest",
|
|
11159
|
+
"subscriber-latest",
|
|
11160
|
+
"sponsor-latest"
|
|
11161
|
+
],
|
|
11162
|
+
kick: [],
|
|
11163
|
+
facebook: []
|
|
11164
|
+
};
|
|
11165
|
+
switch (e) {
|
|
11166
|
+
default:
|
|
11167
|
+
case "random":
|
|
11168
|
+
var i = I.random.array(Object.keys(r).filter((e) => r[e].length))[0], a = I.random.array(r[i])[0];
|
|
11169
|
+
return H(i, a);
|
|
11170
|
+
case "twitch": switch (t) {
|
|
11171
|
+
default:
|
|
11172
|
+
case "random":
|
|
11173
|
+
var a = I.random.array(r[e])[0];
|
|
11174
|
+
return H(e, a);
|
|
11175
|
+
case "message": {
|
|
11176
|
+
let t = n;
|
|
11177
|
+
var o = t?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = t?.message ?? I.random.array([...w.twitch_messages, ...w.normal_messages].filter((e) => e.length))[0], c = await I.message.generateBadges(t?.badges ?? [], e), l = I.message.findEmotesInText(s), u = I.message.replaceEmotesWithHTML(s, l), d = t?.color ?? I.random.color("hex"), f = t?.userId ?? I.random.string(16), p = t?.msgId ?? I.random.string(16), m = t?.time ?? Date.now(), h = t?.channel ?? window?.client?.details?.user?.username ?? "local", g = t?.reply ? {
|
|
11178
|
+
"reply-parent-display-name": t.reply.name,
|
|
11179
|
+
"reply-parent-msg-body": t.reply.text,
|
|
11180
|
+
"reply-parent-msg-id": t.reply.msgId,
|
|
11181
|
+
"reply-parent-user-id": t.reply.userId,
|
|
11182
|
+
"reply-parent-user-login": t.reply.name.toLowerCase()
|
|
11183
|
+
} : {}, _ = t?.thread ? {
|
|
11184
|
+
"reply-thread-parent-msg-id": t.thread.msgId,
|
|
11185
|
+
"reply-thread-parent-user-login": t.thread.name.toLowerCase()
|
|
11186
|
+
} : {}, v = {
|
|
11187
|
+
vip: c.keys.includes("vip") ? "" : void 0,
|
|
11188
|
+
subscriber: c.keys.includes("subscriber") ? "1" : "0",
|
|
11189
|
+
mod: c.keys.includes("moderator") ? "1" : "0",
|
|
11190
|
+
turbo: c.keys.includes("turbo") ? "1" : "0"
|
|
11191
|
+
};
|
|
11192
|
+
return {
|
|
11193
|
+
listener: "message",
|
|
11194
|
+
event: {
|
|
11195
|
+
service: e,
|
|
11196
|
+
data: {
|
|
11197
|
+
time: m,
|
|
11198
|
+
tags: {
|
|
11199
|
+
"badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ?? I.random.number(1, 5)}`).join(",")}`,
|
|
11200
|
+
badges: c.keys.map((e) => `${e}/1`).join(","),
|
|
11201
|
+
...v,
|
|
11202
|
+
"tmi-sent-ts": m.toString(),
|
|
11203
|
+
"room-id": I.random.string(9, "numbers"),
|
|
11204
|
+
"user-id": f,
|
|
11205
|
+
"user-type": "",
|
|
11206
|
+
color: d,
|
|
11207
|
+
"display-name": o,
|
|
11208
|
+
emotes: "",
|
|
11209
|
+
"client-nonce": I.random.string(16),
|
|
11210
|
+
flags: "",
|
|
11211
|
+
id: p,
|
|
11212
|
+
"first-msg": t?.firstMsg ? "1" : "0",
|
|
11213
|
+
"returning-chatter": t?.returningChatter ? "1" : "0",
|
|
11214
|
+
...g,
|
|
11215
|
+
..._
|
|
11216
|
+
},
|
|
11217
|
+
nick: o.toLowerCase(),
|
|
11218
|
+
displayName: o,
|
|
11219
|
+
displayColor: d,
|
|
11220
|
+
channel: h,
|
|
11221
|
+
text: s,
|
|
11222
|
+
isAction: !1,
|
|
11223
|
+
userId: f,
|
|
11224
|
+
msgId: p,
|
|
11225
|
+
badges: c.badges,
|
|
11226
|
+
emotes: l
|
|
11227
|
+
},
|
|
11228
|
+
renderedText: u
|
|
11229
|
+
},
|
|
11230
|
+
emulated: !0
|
|
11231
|
+
};
|
|
11232
|
+
}
|
|
11233
|
+
case "cheer":
|
|
11234
|
+
case "cheer-latest":
|
|
11235
|
+
var y = n?.amount ?? I.random.number(100, 1e4), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0];
|
|
11236
|
+
return {
|
|
11237
|
+
listener: "cheer-latest",
|
|
11238
|
+
event: {
|
|
11239
|
+
amount: y,
|
|
11240
|
+
avatar: b,
|
|
11241
|
+
name: o.toLowerCase(),
|
|
11242
|
+
displayName: o,
|
|
11243
|
+
message: s,
|
|
11244
|
+
providerId: "",
|
|
11245
|
+
_id: I.random.uuid(),
|
|
11246
|
+
sessionTop: !1,
|
|
11247
|
+
type: "cheer",
|
|
11248
|
+
originalEventName: "cheer-latest",
|
|
11249
|
+
provider: e
|
|
11250
|
+
},
|
|
11251
|
+
emulated: !0
|
|
11252
|
+
};
|
|
11253
|
+
case "follower":
|
|
11254
|
+
case "follower-latest":
|
|
11255
|
+
var b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
|
|
11256
|
+
return {
|
|
11257
|
+
listener: "follower-latest",
|
|
11258
|
+
event: {
|
|
11259
|
+
avatar: b,
|
|
11260
|
+
name: o.toLowerCase(),
|
|
11261
|
+
displayName: o,
|
|
11262
|
+
providerId: "",
|
|
11263
|
+
_id: I.random.uuid(),
|
|
11264
|
+
sessionTop: !1,
|
|
11265
|
+
type: "follower",
|
|
11266
|
+
originalEventName: "follower-latest",
|
|
11267
|
+
provider: e
|
|
11268
|
+
},
|
|
11269
|
+
emulated: !0
|
|
11270
|
+
};
|
|
11271
|
+
case "raid":
|
|
11272
|
+
case "raid-latest":
|
|
11273
|
+
var y = n?.amount ?? I.random.number(1, 100), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
|
|
11274
|
+
return {
|
|
11275
|
+
listener: "raid-latest",
|
|
11276
|
+
event: {
|
|
11277
|
+
amount: y,
|
|
11278
|
+
avatar: b,
|
|
11279
|
+
name: o.toLowerCase(),
|
|
11280
|
+
displayName: o,
|
|
11281
|
+
providerId: "",
|
|
11282
|
+
_id: I.random.uuid(),
|
|
11283
|
+
sessionTop: !1,
|
|
11284
|
+
type: "raid",
|
|
11285
|
+
originalEventName: "raid-latest",
|
|
11286
|
+
provider: e
|
|
11287
|
+
},
|
|
11288
|
+
emulated: !0
|
|
11289
|
+
};
|
|
11290
|
+
case "subscriber":
|
|
11291
|
+
case "subscriber-latest":
|
|
11292
|
+
var x = n?.tier ?? I.random.array([
|
|
11293
|
+
"1000",
|
|
11294
|
+
"2000",
|
|
11295
|
+
"3000",
|
|
11296
|
+
"prime"
|
|
11297
|
+
])[0], y = n?.amount ?? I.random.number(1, 24), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? I.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
11298
|
+
default: {
|
|
11299
|
+
avatar: b,
|
|
11300
|
+
playedAsCommunityGift: !1
|
|
11301
|
+
},
|
|
11302
|
+
gift: {
|
|
11303
|
+
sender: S,
|
|
11304
|
+
gifted: !0
|
|
11305
|
+
},
|
|
11306
|
+
community: {
|
|
11307
|
+
message: s,
|
|
11308
|
+
sender: S,
|
|
11309
|
+
bulkGifted: !0
|
|
11310
|
+
},
|
|
11311
|
+
spam: {
|
|
11312
|
+
sender: S,
|
|
11313
|
+
gifted: !0,
|
|
11314
|
+
isCommunityGift: !0
|
|
11315
|
+
}
|
|
11316
|
+
}, T = [
|
|
11317
|
+
"default",
|
|
11318
|
+
"gift",
|
|
11319
|
+
"community",
|
|
11320
|
+
"spam"
|
|
11321
|
+
], E = n?.subType ?? I.random.array(T)[0];
|
|
11322
|
+
return E = T.includes(E) ? E : "default", {
|
|
11323
|
+
listener: "subscriber-latest",
|
|
11324
|
+
event: {
|
|
11325
|
+
amount: y,
|
|
11326
|
+
name: o.toLowerCase(),
|
|
11327
|
+
displayName: o,
|
|
11328
|
+
providerId: "",
|
|
11329
|
+
tier: x,
|
|
11330
|
+
...C.default,
|
|
11331
|
+
...C[E],
|
|
11332
|
+
_id: I.random.uuid(),
|
|
11333
|
+
sessionTop: !1,
|
|
11334
|
+
type: "subscriber",
|
|
11335
|
+
originalEventName: "subscriber-latest",
|
|
11336
|
+
provider: e
|
|
11337
|
+
},
|
|
11338
|
+
emulated: !0
|
|
11339
|
+
};
|
|
11340
|
+
case "delete-message": return {
|
|
11341
|
+
listener: "delete-message",
|
|
11342
|
+
event: {
|
|
11343
|
+
msgId: n?.id ?? I.random.uuid(),
|
|
11344
|
+
provider: e
|
|
11345
|
+
},
|
|
11346
|
+
emulated: !0
|
|
11347
|
+
};
|
|
11348
|
+
case "delete-messages": return {
|
|
11349
|
+
listener: "delete-messages",
|
|
11350
|
+
event: {
|
|
11351
|
+
userId: n?.id ?? I.random.number(1e7, 99999999).toString(),
|
|
11352
|
+
provider: e
|
|
11353
|
+
},
|
|
11354
|
+
emulated: !0
|
|
11355
|
+
};
|
|
11356
|
+
case "event":
|
|
11357
|
+
switch (n?.type) {
|
|
11358
|
+
case "channelPointsRedemption":
|
|
11359
|
+
var y = n?.amount ?? I.random.number(1, 100), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0], D = n?.redemption ?? I.random.array([
|
|
11360
|
+
"Highlight Message",
|
|
11361
|
+
"Send a Shoutout",
|
|
11362
|
+
"Drink Water"
|
|
11363
|
+
])[0], O = n?.quantity ?? 1, k = n?.providerId ?? I.random.uuid(), A = n?.id ?? I.random.uuid(), h = n?.channel ?? n?.broadcaster ?? n?.streamer ?? window?.client?.details?.user?.username ?? "local", j = n?.activityId ?? I.random.uuid(), m = n?.time ?? Date.now();
|
|
11364
|
+
return {
|
|
11365
|
+
listener: "event",
|
|
11366
|
+
event: {
|
|
11367
|
+
type: "channelPointsRedemption",
|
|
11368
|
+
_id: A,
|
|
11369
|
+
provider: "twitch",
|
|
11370
|
+
flagged: !1,
|
|
11371
|
+
channel: h,
|
|
11372
|
+
createdAt: new Date(m).toISOString(),
|
|
11373
|
+
expiresAt: new Date(m + 36e5).toISOString(),
|
|
11374
|
+
updatedAt: new Date(m).toISOString(),
|
|
11375
|
+
activityId: j,
|
|
11376
|
+
sessionEventsCount: 1,
|
|
11377
|
+
isMock: !0,
|
|
11378
|
+
data: {
|
|
11379
|
+
amount: y,
|
|
11380
|
+
username: o.toLowerCase(),
|
|
11381
|
+
displayName: o,
|
|
11382
|
+
providerId: k,
|
|
11383
|
+
avatar: b,
|
|
11384
|
+
message: s,
|
|
11385
|
+
quantity: O,
|
|
11386
|
+
redemption: D
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
};
|
|
11390
|
+
case "cheer": break;
|
|
11391
|
+
case "follower": break;
|
|
11392
|
+
case "subscriber": break;
|
|
11393
|
+
}
|
|
11394
|
+
break;
|
|
10979
11395
|
}
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
11396
|
+
case "streamelements": switch (t) {
|
|
11397
|
+
default:
|
|
11398
|
+
case "random":
|
|
11399
|
+
var a = I.random.array(r[e])[0];
|
|
11400
|
+
return H(e, a);
|
|
11401
|
+
case "tip":
|
|
11402
|
+
case "tip-latest":
|
|
11403
|
+
var y = n?.amount ?? I.random.number(100, 4e3), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
|
|
11404
|
+
return {
|
|
11405
|
+
listener: "tip-latest",
|
|
11406
|
+
event: {
|
|
11407
|
+
amount: y,
|
|
11408
|
+
avatar: b,
|
|
11409
|
+
name: o.toLowerCase(),
|
|
11410
|
+
displayName: o,
|
|
11411
|
+
providerId: "",
|
|
11412
|
+
_id: I.random.uuid(),
|
|
11413
|
+
sessionTop: !1,
|
|
11414
|
+
type: "tip",
|
|
11415
|
+
originalEventName: "tip-latest",
|
|
11416
|
+
provider: e
|
|
11417
|
+
},
|
|
11418
|
+
emulated: !0
|
|
11419
|
+
};
|
|
11420
|
+
case "kvstore:update": return {
|
|
11421
|
+
listener: "kvstore:update",
|
|
11422
|
+
event: {
|
|
11423
|
+
data: {
|
|
11424
|
+
key: `customWidget.${n?.key ?? "sampleKey"}`,
|
|
11425
|
+
value: n?.value ?? "sampleValue"
|
|
11426
|
+
},
|
|
11427
|
+
provider: e
|
|
11428
|
+
},
|
|
11429
|
+
emulated: !0
|
|
11430
|
+
};
|
|
11431
|
+
case "bot:counter": return {
|
|
11432
|
+
listener: "bot:counter",
|
|
11433
|
+
event: {
|
|
11434
|
+
counter: n?.counter ?? "sampleCounter",
|
|
11435
|
+
value: n?.value ?? I.random.number(0, 100),
|
|
11436
|
+
provider: e
|
|
11437
|
+
},
|
|
11438
|
+
emulated: !0
|
|
11439
|
+
};
|
|
11440
|
+
case "mute":
|
|
11441
|
+
case "unmute":
|
|
11442
|
+
case "alertService:toggleSound": return {
|
|
11443
|
+
listener: "alertService:toggleSound",
|
|
11444
|
+
event: {
|
|
11445
|
+
muted: n?.muted ?? window?.client?.details?.overlay?.muted ?? !1,
|
|
11446
|
+
provider: e
|
|
11447
|
+
},
|
|
11448
|
+
emulated: !0
|
|
11449
|
+
};
|
|
11450
|
+
case "skip":
|
|
11451
|
+
case "event:skip": return {
|
|
11452
|
+
listener: "event:skip",
|
|
11453
|
+
event: { provider: e },
|
|
11454
|
+
emulated: !0
|
|
11455
|
+
};
|
|
10984
11456
|
}
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11457
|
+
case "youtube": switch (t) {
|
|
11458
|
+
default:
|
|
11459
|
+
case "random":
|
|
11460
|
+
var a = I.random.array(r[e])[0];
|
|
11461
|
+
return H(e, a);
|
|
11462
|
+
case "message": {
|
|
11463
|
+
var o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? I.random.array([...w.youtube_messages, ...w.normal_messages].filter((e) => e.length))[0];
|
|
11464
|
+
let t = await I.message.generateBadges(n?.badges ?? [], e);
|
|
11465
|
+
var l = I.message.findEmotesInText(s), u = I.message.replaceEmotesWithHTML(s, l), d = n?.color ?? I.random.color("hex"), f = n?.userId ?? I.random.number(1e7, 99999999).toString(), p = n?.msgId ?? I.random.uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? I.random.array(w.avatars)[0], h = n?.channel ?? window?.client?.details?.user?.username ?? "local";
|
|
11466
|
+
return {
|
|
11467
|
+
listener: "message",
|
|
11468
|
+
event: {
|
|
11469
|
+
service: e,
|
|
11470
|
+
data: {
|
|
11471
|
+
kind: "",
|
|
11472
|
+
etag: "",
|
|
11473
|
+
id: "",
|
|
11474
|
+
snippet: {
|
|
11475
|
+
type: "",
|
|
11476
|
+
liveChatId: "",
|
|
11477
|
+
authorChannelId: h,
|
|
11478
|
+
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11479
|
+
hasDisplayContent: !0,
|
|
11480
|
+
displayMessage: s,
|
|
11481
|
+
textMessageDetails: { messageText: s }
|
|
11482
|
+
},
|
|
11483
|
+
authorDetails: {
|
|
11484
|
+
channelId: h,
|
|
11485
|
+
channelUrl: "",
|
|
11486
|
+
displayName: o,
|
|
11487
|
+
profileImageUrl: b,
|
|
11488
|
+
...t
|
|
11489
|
+
},
|
|
11490
|
+
msgId: p,
|
|
11491
|
+
userId: f,
|
|
11492
|
+
nick: o.toLowerCase(),
|
|
11493
|
+
badges: [],
|
|
11494
|
+
displayName: o,
|
|
11495
|
+
isAction: !1,
|
|
11496
|
+
time: m,
|
|
11497
|
+
tags: [],
|
|
11498
|
+
displayColor: d,
|
|
11499
|
+
channel: h,
|
|
11500
|
+
text: s,
|
|
11501
|
+
avatar: b,
|
|
11502
|
+
emotes: []
|
|
11503
|
+
},
|
|
11504
|
+
renderedText: s
|
|
11505
|
+
},
|
|
11506
|
+
emulated: !0
|
|
11507
|
+
};
|
|
11012
11508
|
}
|
|
11509
|
+
case "subscriber":
|
|
11510
|
+
case "subscriber-latest":
|
|
11511
|
+
var b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
|
|
11512
|
+
return {
|
|
11513
|
+
listener: "subscriber-latest",
|
|
11514
|
+
event: {
|
|
11515
|
+
avatar: b,
|
|
11516
|
+
displayName: o,
|
|
11517
|
+
name: o.toLowerCase(),
|
|
11518
|
+
providerId: "",
|
|
11519
|
+
_id: I.random.uuid(),
|
|
11520
|
+
sessionTop: !1,
|
|
11521
|
+
type: "subscriber",
|
|
11522
|
+
originalEventName: "subscriber-latest",
|
|
11523
|
+
provider: e
|
|
11524
|
+
},
|
|
11525
|
+
emulated: !0
|
|
11526
|
+
};
|
|
11527
|
+
case "superchat":
|
|
11528
|
+
case "superchat-latest":
|
|
11529
|
+
var y = n?.amount ?? I.random.number(100, 4e3), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0];
|
|
11530
|
+
return {
|
|
11531
|
+
listener: "superchat-latest",
|
|
11532
|
+
event: {
|
|
11533
|
+
amount: y,
|
|
11534
|
+
avatar: b,
|
|
11535
|
+
name: o.toLowerCase(),
|
|
11536
|
+
displayName: o,
|
|
11537
|
+
providerId: "",
|
|
11538
|
+
_id: I.random.uuid(),
|
|
11539
|
+
sessionTop: !1,
|
|
11540
|
+
type: "superchat",
|
|
11541
|
+
originalEventName: "superchat-latest",
|
|
11542
|
+
provider: e
|
|
11543
|
+
},
|
|
11544
|
+
emulated: !0
|
|
11545
|
+
};
|
|
11546
|
+
case "sponsor":
|
|
11547
|
+
case "sponsor-latest":
|
|
11548
|
+
var x = n?.tier ?? I.random.array([
|
|
11549
|
+
"1000",
|
|
11550
|
+
"2000",
|
|
11551
|
+
"3000"
|
|
11552
|
+
])[0], y = n?.amount ?? I.random.number(1, 24), b = n?.avatar ?? I.random.array(w.avatars)[0], o = n?.name ?? I.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? I.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? I.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
11553
|
+
default: {
|
|
11554
|
+
avatar: b,
|
|
11555
|
+
playedAsCommunityGift: !1
|
|
11556
|
+
},
|
|
11557
|
+
gift: {
|
|
11558
|
+
sender: S,
|
|
11559
|
+
gifted: !0
|
|
11560
|
+
},
|
|
11561
|
+
community: {
|
|
11562
|
+
message: s,
|
|
11563
|
+
sender: S,
|
|
11564
|
+
bulkGifted: !0
|
|
11565
|
+
},
|
|
11566
|
+
spam: {
|
|
11567
|
+
sender: S,
|
|
11568
|
+
gifted: !0,
|
|
11569
|
+
isCommunityGift: !0
|
|
11570
|
+
}
|
|
11571
|
+
}, T = [
|
|
11572
|
+
"default",
|
|
11573
|
+
"gift",
|
|
11574
|
+
"community",
|
|
11575
|
+
"spam"
|
|
11576
|
+
], E = n?.subType ?? I.random.array(T)[0];
|
|
11577
|
+
return E = T.includes(E) ? E : "default", {
|
|
11578
|
+
listener: "sponsor-latest",
|
|
11579
|
+
event: {
|
|
11580
|
+
amount: y,
|
|
11581
|
+
name: o.toLowerCase(),
|
|
11582
|
+
displayName: o,
|
|
11583
|
+
providerId: "",
|
|
11584
|
+
...C.default,
|
|
11585
|
+
...C[E],
|
|
11586
|
+
_id: I.random.uuid(),
|
|
11587
|
+
sessionTop: !1,
|
|
11588
|
+
type: "sponsor",
|
|
11589
|
+
originalEventName: "sponsor-latest",
|
|
11590
|
+
provider: e
|
|
11591
|
+
},
|
|
11592
|
+
emulated: !0
|
|
11593
|
+
};
|
|
11013
11594
|
}
|
|
11014
|
-
}
|
|
11015
|
-
|
|
11595
|
+
}
|
|
11596
|
+
}
|
|
11597
|
+
var U = new class {
|
|
11598
|
+
constructor() {
|
|
11599
|
+
this.event = {
|
|
11600
|
+
onWidgetLoad: ce,
|
|
11601
|
+
onSessionUpdate: le,
|
|
11602
|
+
onEventReceived: H
|
|
11603
|
+
}, this.session = {
|
|
11016
11604
|
types: {
|
|
11017
11605
|
name: {
|
|
11018
11606
|
type: "string",
|
|
@@ -11916,10 +12504,10 @@ var K = class extends e {
|
|
|
11916
12504
|
return typeof e != "object" || !e ? e : "type" in e && typeof e.type == "string" ? ((e) => {
|
|
11917
12505
|
if (!e) return e;
|
|
11918
12506
|
switch (e.type) {
|
|
11919
|
-
case "int": return
|
|
11920
|
-
case "string": return
|
|
11921
|
-
case "date": return
|
|
11922
|
-
case "array": return
|
|
12507
|
+
case "int": return I.random.number(e.min, e.max);
|
|
12508
|
+
case "string": return I.random.array(e.options)[0];
|
|
12509
|
+
case "date": return I.random.daysOffset(e.range);
|
|
12510
|
+
case "array": return I.random.array(e.options)[0];
|
|
11923
12511
|
case "recent": return t(e);
|
|
11924
12512
|
default: return e;
|
|
11925
12513
|
}
|
|
@@ -11934,639 +12522,93 @@ var K = class extends e {
|
|
|
11934
12522
|
};
|
|
11935
12523
|
return Object.entries(n(t)).reduce((e, [t, n]) => (Object.entries(n).forEach(([n, r]) => e[`${t}-${n}`] = r), e), {});
|
|
11936
12524
|
}
|
|
11937
|
-
}
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
e["follower-latest"].name = t, e["follower-session"].count += 1, e["follower-week"].count += 1, e["follower-month"].count += 1, e["follower-total"].count += 1, e["follower-goal"].amount += 1, e["follower-recent"].unshift({
|
|
12017
|
-
name: t,
|
|
12018
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12019
|
-
}), e["follower-recent"] = (e["follower-recent"] || []).sort(n);
|
|
12020
|
-
break;
|
|
12021
|
-
}
|
|
12022
|
-
case "subscriber-latest": {
|
|
12023
|
-
let t = r.event.displayName ?? r.event.name, i = r.event.amount, a = r.event.tier, o = r.event.message;
|
|
12024
|
-
if (e["subscriber-latest"] = {
|
|
12025
|
-
name: t,
|
|
12026
|
-
amount: i,
|
|
12027
|
-
tier: a,
|
|
12028
|
-
message: o ?? ""
|
|
12029
|
-
}, e["subscriber-recent"].find((e) => e.name.toLowerCase() === t.toLowerCase()) ? i > 1 && (e["subscriber-resub-latest"] = {
|
|
12030
|
-
name: t,
|
|
12031
|
-
amount: i,
|
|
12032
|
-
message: o ?? ""
|
|
12033
|
-
}, e["subscriber-resub-session"].count += 1) : (e["subscriber-new-latest"] = {
|
|
12034
|
-
name: t,
|
|
12035
|
-
amount: i,
|
|
12036
|
-
message: o ?? ""
|
|
12037
|
-
}, e["subscriber-new-session"].count += 1), !(!r.event.gifted && !r.event.bulkGifted && !r.event.isCommunityGift)) if (r.event.gifted && !r.event.bulkGifted && !r.event.isCommunityGift) {
|
|
12038
|
-
let n = r.event.sender;
|
|
12039
|
-
e["subscriber-gifted-latest"] = {
|
|
12040
|
-
name: t,
|
|
12041
|
-
amount: i,
|
|
12042
|
-
tier: a,
|
|
12043
|
-
message: o ?? "",
|
|
12044
|
-
sender: n
|
|
12045
|
-
}, e["subscriber-gifted-session"].count += 1, e["subscriber-alltime-gifter"] = {
|
|
12046
|
-
name: n,
|
|
12047
|
-
amount: i
|
|
12048
|
-
};
|
|
12049
|
-
} else r.event.gifted && !r.event.bulkGifted && r.event.isCommunityGift || !r.event.gifted && r.event.bulkGifted && r.event.isCommunityGift;
|
|
12050
|
-
e["subscriber-session"].count += i, e["subscriber-week"].count += i, e["subscriber-month"].count += i, e["subscriber-total"].count += i, e["subscriber-goal"].amount += i, e["subscriber-points"].amount += i, e["subscriber-recent"].unshift({
|
|
12051
|
-
name: t,
|
|
12052
|
-
amount: i,
|
|
12053
|
-
tier: a,
|
|
12054
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12055
|
-
}), e["subscriber-recent"] = (e["subscriber-recent"] || []).sort(n);
|
|
12056
|
-
break;
|
|
12057
|
-
}
|
|
12058
|
-
case "raid-latest": {
|
|
12059
|
-
let t = r.event.displayName ?? r.event.name, i = r.event.amount;
|
|
12060
|
-
e["raid-latest"] = {
|
|
12061
|
-
name: t,
|
|
12062
|
-
amount: i
|
|
12063
|
-
}, e["raid-recent"].unshift({
|
|
12064
|
-
name: t,
|
|
12065
|
-
amount: i,
|
|
12066
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12067
|
-
}), e["raid-recent"] = (e["raid-recent"] || []).sort(n);
|
|
12068
|
-
break;
|
|
12069
|
-
}
|
|
12070
|
-
}
|
|
12071
|
-
break;
|
|
12072
|
-
}
|
|
12073
|
-
case "youtube": {
|
|
12074
|
-
let n = t.data;
|
|
12075
|
-
switch (n.listener) {
|
|
12076
|
-
case "superchat-latest": {
|
|
12077
|
-
let t = n.event.displayName ?? n.event.name, r = n.event.amount;
|
|
12078
|
-
e["superchat-latest"] = {
|
|
12079
|
-
name: t.toLowerCase(),
|
|
12080
|
-
displayName: t,
|
|
12081
|
-
amount: r,
|
|
12082
|
-
_id: B.random.uuid(),
|
|
12083
|
-
sessionTop: !1,
|
|
12084
|
-
type: "superchat",
|
|
12085
|
-
originalEventName: "superchat-latest",
|
|
12086
|
-
providerId: "",
|
|
12087
|
-
avatar: ""
|
|
12088
|
-
};
|
|
12089
|
-
let i = (n) => {
|
|
12090
|
-
if (n === "all") {
|
|
12091
|
-
i("alltime"), i("monthly"), i("weekly"), i("session");
|
|
12092
|
-
return;
|
|
12093
|
-
}
|
|
12094
|
-
let a = e[`superchat-${n}-top-donation`];
|
|
12095
|
-
a && r > a.amount && (a.amount = r, a.name = t);
|
|
12096
|
-
let o = e[`superchat-${n}-top-donator`], s = e["superchat-recent"].filter((e) => e.name.toLowerCase() === o.name.toLowerCase()).reduce((e, t) => e + t.amount, 0), c = e["superchat-recent"].filter((e) => e.name.toLowerCase() === t.toLowerCase()).reduce((e, t) => e + t.amount, 0);
|
|
12097
|
-
c > s && (o.amount = c, o.name = t);
|
|
12098
|
-
};
|
|
12099
|
-
i("all"), e["superchat-session"].amount += r, e["superchat-week"].amount += r, e["superchat-month"].amount += r, e["superchat-total"].amount += r, e["superchat-count"].count += 1, e["superchat-goal"].amount += r, e["superchat-recent"].unshift({
|
|
12100
|
-
name: t.toLowerCase(),
|
|
12101
|
-
displayName: t,
|
|
12102
|
-
amount: r,
|
|
12103
|
-
_id: B.random.uuid(),
|
|
12104
|
-
sessionTop: !1,
|
|
12105
|
-
type: "superchat",
|
|
12106
|
-
originalEventName: "superchat-latest",
|
|
12107
|
-
avatar: "",
|
|
12108
|
-
providerId: ""
|
|
12109
|
-
});
|
|
12110
|
-
break;
|
|
12111
|
-
}
|
|
12112
|
-
}
|
|
12113
|
-
break;
|
|
12114
|
-
}
|
|
12115
|
-
case "streamelements": {
|
|
12116
|
-
let r = t.data;
|
|
12117
|
-
switch (r.listener) {
|
|
12118
|
-
case "tip-latest": {
|
|
12119
|
-
let t = r.event.displayName ?? r.event.name, i = r.event.amount;
|
|
12120
|
-
e["tip-latest"] = {
|
|
12121
|
-
name: t,
|
|
12122
|
-
amount: i
|
|
12123
|
-
};
|
|
12124
|
-
let a = (n) => {
|
|
12125
|
-
if (n === "all") {
|
|
12126
|
-
a("alltime"), a("monthly"), a("weekly"), a("session");
|
|
12127
|
-
return;
|
|
12128
|
-
}
|
|
12129
|
-
let r = e[`tip-${n}-top-donation`];
|
|
12130
|
-
r && i > r.amount && (r.amount = i, r.name = t);
|
|
12131
|
-
let o = e[`tip-${n}-top-donator`], s = e["tip-recent"].filter((e) => e.name.toLowerCase() === o.name.toLowerCase()).reduce((e, t) => e + t.amount, 0), c = e["tip-recent"].filter((e) => e.name.toLowerCase() === t.toLowerCase()).reduce((e, t) => e + t.amount, 0);
|
|
12132
|
-
c > s && (o.amount = c, o.name = t);
|
|
12133
|
-
};
|
|
12134
|
-
a("all"), e["tip-session"].amount += i, e["tip-week"].amount += i, e["tip-month"].amount += i, e["tip-total"].amount += i, e["tip-count"].count += 1, e["tip-goal"].amount += i, e["tip-recent"].unshift({
|
|
12135
|
-
name: t,
|
|
12136
|
-
amount: i,
|
|
12137
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12138
|
-
}), e["tip-recent"] = (e["tip-recent"] || []).sort(n);
|
|
12139
|
-
break;
|
|
12140
|
-
}
|
|
12141
|
-
case "event:test": break;
|
|
12142
|
-
}
|
|
12143
|
-
break;
|
|
12144
|
-
}
|
|
12145
|
-
}
|
|
12146
|
-
}
|
|
12147
|
-
return {
|
|
12148
|
-
session: e,
|
|
12149
|
-
emulated: !0
|
|
12150
|
-
};
|
|
12151
|
-
},
|
|
12152
|
-
async onEventReceived(e = "random", t = "random", n = {}) {
|
|
12153
|
-
let r = {
|
|
12154
|
-
twitch: [
|
|
12155
|
-
"message",
|
|
12156
|
-
"follower-latest",
|
|
12157
|
-
"cheer-latest",
|
|
12158
|
-
"raid-latest",
|
|
12159
|
-
"subscriber-latest"
|
|
12160
|
-
],
|
|
12161
|
-
streamelements: ["tip-latest"],
|
|
12162
|
-
youtube: [
|
|
12163
|
-
"message",
|
|
12164
|
-
"superchat-latest",
|
|
12165
|
-
"subscriber-latest",
|
|
12166
|
-
"sponsor-latest"
|
|
12167
|
-
],
|
|
12168
|
-
kick: [],
|
|
12169
|
-
facebook: []
|
|
12170
|
-
};
|
|
12171
|
-
switch (e) {
|
|
12172
|
-
default:
|
|
12173
|
-
case "random":
|
|
12174
|
-
var i = B.random.array(Object.keys(r).filter((e) => r[e].length))[0], a = B.random.array(r[i])[0];
|
|
12175
|
-
return this.onEventReceived(i, a);
|
|
12176
|
-
case "twitch": switch (t) {
|
|
12177
|
-
default:
|
|
12178
|
-
case "random":
|
|
12179
|
-
var a = B.random.array(r[e])[0];
|
|
12180
|
-
return this.onEventReceived(e, a);
|
|
12181
|
-
case "message": {
|
|
12182
|
-
let t = n;
|
|
12183
|
-
var o = t?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = t?.message ?? B.random.array([...w.twitch_messages, ...w.normal_messages].filter((e) => e.length))[0], c = await B.message.generateBadges(t?.badges ?? [], e), l = B.message.findEmotesInText(s), u = B.message.replaceEmotesWithHTML(s, l), d = t?.color ?? B.random.color("hex"), f = t?.userId ?? B.random.string(16), p = t?.msgId ?? B.random.string(16), m = t?.time ?? Date.now(), h = t?.channel ?? window?.client?.details?.user?.username ?? "local", g = t?.reply ? {
|
|
12184
|
-
"reply-parent-display-name": t.reply.name,
|
|
12185
|
-
"reply-parent-msg-body": t.reply.text,
|
|
12186
|
-
"reply-parent-msg-id": t.reply.msgId,
|
|
12187
|
-
"reply-parent-user-id": t.reply.userId,
|
|
12188
|
-
"reply-parent-user-login": t.reply.name.toLowerCase()
|
|
12189
|
-
} : {}, _ = t?.thread ? {
|
|
12190
|
-
"reply-thread-parent-msg-id": t.thread.msgId,
|
|
12191
|
-
"reply-thread-parent-user-login": t.thread.name.toLowerCase()
|
|
12192
|
-
} : {}, v = {
|
|
12193
|
-
vip: c.keys.includes("vip") ? "" : void 0,
|
|
12194
|
-
subscriber: c.keys.includes("subscriber") ? "1" : "0",
|
|
12195
|
-
mod: c.keys.includes("moderator") ? "1" : "0",
|
|
12196
|
-
turbo: c.keys.includes("turbo") ? "1" : "0"
|
|
12197
|
-
};
|
|
12198
|
-
return {
|
|
12199
|
-
listener: "message",
|
|
12200
|
-
event: {
|
|
12201
|
-
service: e,
|
|
12202
|
-
data: {
|
|
12203
|
-
time: m,
|
|
12204
|
-
tags: {
|
|
12205
|
-
"badge-info": `${c.keys.map((e) => `${e}/${c.amount[e] ?? B.random.number(1, 5)}`).join(",")}`,
|
|
12206
|
-
badges: c.keys.map((e) => `${e}/1`).join(","),
|
|
12207
|
-
...v,
|
|
12208
|
-
"tmi-sent-ts": m.toString(),
|
|
12209
|
-
"room-id": B.random.string(9, "numbers"),
|
|
12210
|
-
"user-id": f,
|
|
12211
|
-
"user-type": "",
|
|
12212
|
-
color: d,
|
|
12213
|
-
"display-name": o,
|
|
12214
|
-
emotes: "",
|
|
12215
|
-
"client-nonce": B.random.string(16),
|
|
12216
|
-
flags: "",
|
|
12217
|
-
id: p,
|
|
12218
|
-
"first-msg": t?.firstMsg ? "1" : "0",
|
|
12219
|
-
"returning-chatter": t?.returningChatter ? "1" : "0",
|
|
12220
|
-
...g,
|
|
12221
|
-
..._
|
|
12222
|
-
},
|
|
12223
|
-
nick: o.toLowerCase(),
|
|
12224
|
-
displayName: o,
|
|
12225
|
-
displayColor: d,
|
|
12226
|
-
channel: h,
|
|
12227
|
-
text: s,
|
|
12228
|
-
isAction: !1,
|
|
12229
|
-
userId: f,
|
|
12230
|
-
msgId: p,
|
|
12231
|
-
badges: c.badges,
|
|
12232
|
-
emotes: l
|
|
12233
|
-
},
|
|
12234
|
-
renderedText: u
|
|
12235
|
-
},
|
|
12236
|
-
emulated: !0
|
|
12237
|
-
};
|
|
12238
|
-
}
|
|
12239
|
-
case "cheer":
|
|
12240
|
-
case "cheer-latest":
|
|
12241
|
-
var y = n?.amount ?? B.random.number(100, 1e4), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0];
|
|
12242
|
-
return {
|
|
12243
|
-
listener: "cheer-latest",
|
|
12244
|
-
event: {
|
|
12245
|
-
amount: y,
|
|
12246
|
-
avatar: b,
|
|
12247
|
-
name: o.toLowerCase(),
|
|
12248
|
-
displayName: o,
|
|
12249
|
-
message: s,
|
|
12250
|
-
providerId: "",
|
|
12251
|
-
_id: B.random.uuid(),
|
|
12252
|
-
sessionTop: !1,
|
|
12253
|
-
type: "cheer",
|
|
12254
|
-
originalEventName: "cheer-latest",
|
|
12255
|
-
provider: e
|
|
12256
|
-
},
|
|
12257
|
-
emulated: !0
|
|
12258
|
-
};
|
|
12259
|
-
case "follower":
|
|
12260
|
-
case "follower-latest":
|
|
12261
|
-
var b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12262
|
-
return {
|
|
12263
|
-
listener: "follower-latest",
|
|
12264
|
-
event: {
|
|
12265
|
-
avatar: b,
|
|
12266
|
-
name: o.toLowerCase(),
|
|
12267
|
-
displayName: o,
|
|
12268
|
-
providerId: "",
|
|
12269
|
-
_id: B.random.uuid(),
|
|
12270
|
-
sessionTop: !1,
|
|
12271
|
-
type: "follower",
|
|
12272
|
-
originalEventName: "follower-latest",
|
|
12273
|
-
provider: e
|
|
12274
|
-
},
|
|
12275
|
-
emulated: !0
|
|
12276
|
-
};
|
|
12277
|
-
case "raid":
|
|
12278
|
-
case "raid-latest":
|
|
12279
|
-
var y = n?.amount ?? B.random.number(1, 100), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12280
|
-
return {
|
|
12281
|
-
listener: "raid-latest",
|
|
12282
|
-
event: {
|
|
12283
|
-
amount: y,
|
|
12284
|
-
avatar: b,
|
|
12285
|
-
name: o.toLowerCase(),
|
|
12286
|
-
displayName: o,
|
|
12287
|
-
providerId: "",
|
|
12288
|
-
_id: B.random.uuid(),
|
|
12289
|
-
sessionTop: !1,
|
|
12290
|
-
type: "raid",
|
|
12291
|
-
originalEventName: "raid-latest",
|
|
12292
|
-
provider: e
|
|
12293
|
-
},
|
|
12294
|
-
emulated: !0
|
|
12295
|
-
};
|
|
12296
|
-
case "subscriber":
|
|
12297
|
-
case "subscriber-latest":
|
|
12298
|
-
var x = n?.tier ?? B.random.array([
|
|
12299
|
-
"1000",
|
|
12300
|
-
"2000",
|
|
12301
|
-
"3000",
|
|
12302
|
-
"prime"
|
|
12303
|
-
])[0], y = n?.amount ?? B.random.number(1, 24), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? B.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
12304
|
-
default: {
|
|
12305
|
-
avatar: b,
|
|
12306
|
-
playedAsCommunityGift: !1
|
|
12307
|
-
},
|
|
12308
|
-
gift: {
|
|
12309
|
-
sender: S,
|
|
12310
|
-
gifted: !0
|
|
12311
|
-
},
|
|
12312
|
-
community: {
|
|
12313
|
-
message: s,
|
|
12314
|
-
sender: S,
|
|
12315
|
-
bulkGifted: !0
|
|
12316
|
-
},
|
|
12317
|
-
spam: {
|
|
12318
|
-
sender: S,
|
|
12319
|
-
gifted: !0,
|
|
12320
|
-
isCommunityGift: !0
|
|
12321
|
-
}
|
|
12322
|
-
}, T = [
|
|
12323
|
-
"default",
|
|
12324
|
-
"gift",
|
|
12325
|
-
"community",
|
|
12326
|
-
"spam"
|
|
12327
|
-
], E = n?.subType ?? B.random.array(T)[0];
|
|
12328
|
-
return E = T.includes(E) ? E : "default", {
|
|
12329
|
-
listener: "subscriber-latest",
|
|
12330
|
-
event: {
|
|
12331
|
-
amount: y,
|
|
12332
|
-
name: o.toLowerCase(),
|
|
12333
|
-
displayName: o,
|
|
12334
|
-
providerId: "",
|
|
12335
|
-
tier: x,
|
|
12336
|
-
...C.default,
|
|
12337
|
-
...C[E],
|
|
12338
|
-
_id: B.random.uuid(),
|
|
12339
|
-
sessionTop: !1,
|
|
12340
|
-
type: "subscriber",
|
|
12341
|
-
originalEventName: "subscriber-latest",
|
|
12342
|
-
provider: e
|
|
12343
|
-
},
|
|
12344
|
-
emulated: !0
|
|
12345
|
-
};
|
|
12346
|
-
case "delete-message": return {
|
|
12347
|
-
listener: "delete-message",
|
|
12348
|
-
event: {
|
|
12349
|
-
msgId: n?.id ?? B.random.uuid(),
|
|
12350
|
-
provider: e
|
|
12351
|
-
},
|
|
12352
|
-
emulated: !0
|
|
12353
|
-
};
|
|
12354
|
-
case "delete-messages": return {
|
|
12355
|
-
listener: "delete-messages",
|
|
12356
|
-
event: {
|
|
12357
|
-
userId: n?.id ?? B.random.number(1e7, 99999999).toString(),
|
|
12358
|
-
provider: e
|
|
12359
|
-
},
|
|
12360
|
-
emulated: !0
|
|
12361
|
-
};
|
|
12362
|
-
}
|
|
12363
|
-
case "streamelements": switch (t) {
|
|
12364
|
-
default:
|
|
12365
|
-
case "random":
|
|
12366
|
-
var a = B.random.array(r[e])[0];
|
|
12367
|
-
return this.onEventReceived(e, a);
|
|
12368
|
-
case "tip":
|
|
12369
|
-
case "tip-latest":
|
|
12370
|
-
var y = n?.amount ?? B.random.number(100, 4e3), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12371
|
-
return {
|
|
12372
|
-
listener: "tip-latest",
|
|
12373
|
-
event: {
|
|
12374
|
-
amount: y,
|
|
12375
|
-
avatar: b,
|
|
12376
|
-
name: o.toLowerCase(),
|
|
12377
|
-
displayName: o,
|
|
12378
|
-
providerId: "",
|
|
12379
|
-
_id: B.random.uuid(),
|
|
12380
|
-
sessionTop: !1,
|
|
12381
|
-
type: "tip",
|
|
12382
|
-
originalEventName: "tip-latest",
|
|
12383
|
-
provider: e
|
|
12384
|
-
},
|
|
12385
|
-
emulated: !0
|
|
12386
|
-
};
|
|
12387
|
-
case "kvstore:update": return {
|
|
12388
|
-
listener: "kvstore:update",
|
|
12389
|
-
event: {
|
|
12390
|
-
data: {
|
|
12391
|
-
key: `customWidget.${n?.key ?? "sampleKey"}`,
|
|
12392
|
-
value: n?.value ?? "sampleValue"
|
|
12393
|
-
},
|
|
12394
|
-
provider: e
|
|
12395
|
-
},
|
|
12396
|
-
emulated: !0
|
|
12397
|
-
};
|
|
12398
|
-
case "bot:counter": return {
|
|
12399
|
-
listener: "bot:counter",
|
|
12400
|
-
event: {
|
|
12401
|
-
counter: n?.counter ?? "sampleCounter",
|
|
12402
|
-
value: n?.value ?? B.random.number(0, 100),
|
|
12403
|
-
provider: e
|
|
12404
|
-
},
|
|
12405
|
-
emulated: !0
|
|
12406
|
-
};
|
|
12407
|
-
case "mute":
|
|
12408
|
-
case "unmute":
|
|
12409
|
-
case "alertService:toggleSound": return {
|
|
12410
|
-
listener: "alertService:toggleSound",
|
|
12411
|
-
event: {
|
|
12412
|
-
muted: n?.muted ?? window?.client?.details?.overlay?.muted ?? !1,
|
|
12413
|
-
provider: e
|
|
12414
|
-
},
|
|
12415
|
-
emulated: !0
|
|
12416
|
-
};
|
|
12417
|
-
case "skip":
|
|
12418
|
-
case "event:skip": return {
|
|
12419
|
-
listener: "event:skip",
|
|
12420
|
-
event: { provider: e },
|
|
12421
|
-
emulated: !0
|
|
12422
|
-
};
|
|
12423
|
-
}
|
|
12424
|
-
case "youtube": switch (t) {
|
|
12425
|
-
default:
|
|
12426
|
-
case "random":
|
|
12427
|
-
var a = B.random.array(r[e])[0];
|
|
12428
|
-
return this.onEventReceived(e, a);
|
|
12429
|
-
case "message": {
|
|
12430
|
-
var o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], s = n?.message ?? B.random.array([...w.youtube_messages, ...w.normal_messages].filter((e) => e.length))[0];
|
|
12431
|
-
let t = await B.message.generateBadges(n?.badges ?? [], e);
|
|
12432
|
-
var l = B.message.findEmotesInText(s), u = B.message.replaceEmotesWithHTML(s, l), d = n?.color ?? B.random.color("hex"), f = n?.userId ?? B.random.number(1e7, 99999999).toString(), p = n?.msgId ?? B.random.uuid(), m = n?.time ?? Date.now(), b = n?.avatar ?? B.random.array(w.avatars)[0], h = n?.channel ?? window?.client?.details?.user?.username ?? "local";
|
|
12433
|
-
return {
|
|
12434
|
-
listener: "message",
|
|
12435
|
-
event: {
|
|
12436
|
-
service: e,
|
|
12437
|
-
data: {
|
|
12438
|
-
kind: "",
|
|
12439
|
-
etag: "",
|
|
12440
|
-
id: "",
|
|
12441
|
-
snippet: {
|
|
12442
|
-
type: "",
|
|
12443
|
-
liveChatId: "",
|
|
12444
|
-
authorChannelId: h,
|
|
12445
|
-
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12446
|
-
hasDisplayContent: !0,
|
|
12447
|
-
displayMessage: s,
|
|
12448
|
-
textMessageDetails: { messageText: s }
|
|
12449
|
-
},
|
|
12450
|
-
authorDetails: {
|
|
12451
|
-
channelId: h,
|
|
12452
|
-
channelUrl: "",
|
|
12453
|
-
displayName: o,
|
|
12454
|
-
profileImageUrl: b,
|
|
12455
|
-
...t
|
|
12456
|
-
},
|
|
12457
|
-
msgId: p,
|
|
12458
|
-
userId: f,
|
|
12459
|
-
nick: o.toLowerCase(),
|
|
12460
|
-
badges: [],
|
|
12461
|
-
displayName: o,
|
|
12462
|
-
isAction: !1,
|
|
12463
|
-
time: m,
|
|
12464
|
-
tags: [],
|
|
12465
|
-
displayColor: d,
|
|
12466
|
-
channel: h,
|
|
12467
|
-
text: s,
|
|
12468
|
-
avatar: b,
|
|
12469
|
-
emotes: []
|
|
12470
|
-
},
|
|
12471
|
-
renderedText: s
|
|
12472
|
-
},
|
|
12473
|
-
emulated: !0
|
|
12474
|
-
};
|
|
12475
|
-
}
|
|
12476
|
-
case "subscriber":
|
|
12477
|
-
case "subscriber-latest":
|
|
12478
|
-
var b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12479
|
-
return {
|
|
12480
|
-
listener: "subscriber-latest",
|
|
12481
|
-
event: {
|
|
12482
|
-
avatar: b,
|
|
12483
|
-
displayName: o,
|
|
12484
|
-
name: o.toLowerCase(),
|
|
12485
|
-
providerId: "",
|
|
12486
|
-
_id: B.random.uuid(),
|
|
12487
|
-
sessionTop: !1,
|
|
12488
|
-
type: "subscriber",
|
|
12489
|
-
originalEventName: "subscriber-latest",
|
|
12490
|
-
provider: e
|
|
12491
|
-
},
|
|
12492
|
-
emulated: !0
|
|
12493
|
-
};
|
|
12494
|
-
case "superchat":
|
|
12495
|
-
case "superchat-latest":
|
|
12496
|
-
var y = n?.amount ?? B.random.number(100, 4e3), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0];
|
|
12497
|
-
return {
|
|
12498
|
-
listener: "superchat-latest",
|
|
12499
|
-
event: {
|
|
12500
|
-
amount: y,
|
|
12501
|
-
avatar: b,
|
|
12502
|
-
name: o.toLowerCase(),
|
|
12503
|
-
displayName: o,
|
|
12504
|
-
providerId: "",
|
|
12505
|
-
_id: B.random.uuid(),
|
|
12506
|
-
sessionTop: !1,
|
|
12507
|
-
type: "superchat",
|
|
12508
|
-
originalEventName: "superchat-latest",
|
|
12509
|
-
provider: e
|
|
12510
|
-
},
|
|
12511
|
-
emulated: !0
|
|
12512
|
-
};
|
|
12513
|
-
case "sponsor":
|
|
12514
|
-
case "sponsor-latest":
|
|
12515
|
-
var x = n?.tier ?? B.random.array([
|
|
12516
|
-
"1000",
|
|
12517
|
-
"2000",
|
|
12518
|
-
"3000"
|
|
12519
|
-
])[0], y = n?.amount ?? B.random.number(1, 24), b = n?.avatar ?? B.random.array(w.avatars)[0], o = n?.name ?? B.random.array(w.names.filter((e) => e.length))[0], S = n?.sender ?? B.random.array(w.names.filter((e) => e.length && e !== o))[0], s = n?.message ?? B.random.array(w.normal_messages.filter((e) => e.length))[0], C = {
|
|
12520
|
-
default: {
|
|
12521
|
-
avatar: b,
|
|
12522
|
-
playedAsCommunityGift: !1
|
|
12523
|
-
},
|
|
12524
|
-
gift: {
|
|
12525
|
-
sender: S,
|
|
12526
|
-
gifted: !0
|
|
12527
|
-
},
|
|
12528
|
-
community: {
|
|
12529
|
-
message: s,
|
|
12530
|
-
sender: S,
|
|
12531
|
-
bulkGifted: !0
|
|
12532
|
-
},
|
|
12533
|
-
spam: {
|
|
12534
|
-
sender: S,
|
|
12535
|
-
gifted: !0,
|
|
12536
|
-
isCommunityGift: !0
|
|
12537
|
-
}
|
|
12538
|
-
}, T = [
|
|
12539
|
-
"default",
|
|
12540
|
-
"gift",
|
|
12541
|
-
"community",
|
|
12542
|
-
"spam"
|
|
12543
|
-
], E = n?.subType ?? B.random.array(T)[0];
|
|
12544
|
-
return E = T.includes(E) ? E : "default", {
|
|
12545
|
-
listener: "sponsor-latest",
|
|
12546
|
-
event: {
|
|
12547
|
-
amount: y,
|
|
12548
|
-
name: o.toLowerCase(),
|
|
12549
|
-
displayName: o,
|
|
12550
|
-
providerId: "",
|
|
12551
|
-
...C.default,
|
|
12552
|
-
...C[E],
|
|
12553
|
-
_id: B.random.uuid(),
|
|
12554
|
-
sessionTop: !1,
|
|
12555
|
-
type: "sponsor",
|
|
12556
|
-
originalEventName: "sponsor-latest",
|
|
12557
|
-
provider: e
|
|
12558
|
-
},
|
|
12559
|
-
emulated: !0
|
|
12560
|
-
};
|
|
12561
|
-
}
|
|
12562
|
-
}
|
|
12563
|
-
}
|
|
12525
|
+
};
|
|
12526
|
+
}
|
|
12527
|
+
}(), W = class extends e {
|
|
12528
|
+
constructor(e) {
|
|
12529
|
+
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.clientWaitRetryDelay = 50, !e.processor || typeof e.processor != "function") throw Error("A valid processor function must be provided to useQueue.");
|
|
12530
|
+
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
12531
|
+
}
|
|
12532
|
+
waitForClientAndBindLoad(e = this.duration, t) {
|
|
12533
|
+
if (!(window?.client instanceof r)) {
|
|
12534
|
+
setTimeout(() => this.waitForClientAndBindLoad(e, t), this.clientWaitRetryDelay);
|
|
12535
|
+
return;
|
|
12536
|
+
}
|
|
12537
|
+
window.client.on("load", () => {
|
|
12538
|
+
e === "client" && (this.duration = window?.client?.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0, t && t();
|
|
12539
|
+
});
|
|
12540
|
+
}
|
|
12541
|
+
enqueue(e, t = {}) {
|
|
12542
|
+
let n = this.hasItems(), r = Array.isArray(e) ? e.map((e) => ({
|
|
12543
|
+
value: e.value,
|
|
12544
|
+
options: e.options ?? {}
|
|
12545
|
+
})) : [{
|
|
12546
|
+
value: e,
|
|
12547
|
+
options: t
|
|
12548
|
+
}];
|
|
12549
|
+
for (let e of r) {
|
|
12550
|
+
let t = {
|
|
12551
|
+
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12552
|
+
isLoop: e.options?.isLoop ?? !1,
|
|
12553
|
+
isPriority: e.options?.isPriority ?? !1,
|
|
12554
|
+
isImmediate: e.options?.isImmediate ?? !1,
|
|
12555
|
+
value: e.value
|
|
12556
|
+
};
|
|
12557
|
+
t.isPriority && t.isImmediate ? (this.cancel(), this.priorityQueue.unshift(t)) : (t.isPriority ? this.priorityQueue : this.queue).push(t);
|
|
12558
|
+
}
|
|
12559
|
+
return this.running === !1 && n === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
12560
|
+
}
|
|
12561
|
+
async run() {
|
|
12562
|
+
if (!this.hasItems()) {
|
|
12563
|
+
this.running = !1;
|
|
12564
|
+
return;
|
|
12565
|
+
}
|
|
12566
|
+
this.running = !0, await this.next(), typeof this.duration == "number" && this.duration > 0 ? this.timeouts.push(setTimeout(() => this.run(), this.duration)) : (this.duration === 0 || this.duration !== -1 && this.duration !== !1) && this.run();
|
|
12567
|
+
}
|
|
12568
|
+
async next() {
|
|
12569
|
+
let e = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
|
|
12570
|
+
if (!e) {
|
|
12571
|
+
this.running = !1;
|
|
12572
|
+
return;
|
|
12573
|
+
}
|
|
12574
|
+
try {
|
|
12575
|
+
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
12576
|
+
} catch (e) {
|
|
12577
|
+
Q.error(`Error during item processing: ${e instanceof Error ? e.message : String(e)}`);
|
|
12578
|
+
}
|
|
12579
|
+
this.history.push(e);
|
|
12580
|
+
let t = e.isPriority ? this.priorityQueue : this.queue;
|
|
12581
|
+
e.isLoop && t.push(e);
|
|
12582
|
+
}
|
|
12583
|
+
resume() {
|
|
12584
|
+
return this.running && this.cancel(), this.hasItems() && this.run(), this;
|
|
12585
|
+
}
|
|
12586
|
+
update(e) {
|
|
12587
|
+
return this.queue = e.queue ?? this.queue, this.priorityQueue = e.priorityQueue ?? this.priorityQueue, this.history = e.history ?? this.history, this.hasItems() && this.running === !1 && window.client?.on("load", () => this.run()), this;
|
|
12588
|
+
}
|
|
12589
|
+
cancel() {
|
|
12590
|
+
this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
|
|
12591
|
+
}
|
|
12592
|
+
hasItems() {
|
|
12593
|
+
return this.queue.length > 0 || this.priorityQueue.length > 0;
|
|
12594
|
+
}
|
|
12595
|
+
on(e, t) {
|
|
12596
|
+
return e === "load" && this.loaded ? (t.apply(this), this) : (super.on(e, t), this);
|
|
12597
|
+
}
|
|
12598
|
+
}, G = new W({
|
|
12599
|
+
duration: "client",
|
|
12600
|
+
processor: async function(e) {
|
|
12601
|
+
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
12602
|
+
let t = await U.event.onSessionUpdate(window?.client && window?.client instanceof r ? window.client.session : void 0, I.event.parseProvider(e.data));
|
|
12603
|
+
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: t }));
|
|
12564
12604
|
}
|
|
12565
|
-
}
|
|
12566
|
-
|
|
12605
|
+
}
|
|
12606
|
+
}), K = new class {
|
|
12607
|
+
constructor() {
|
|
12608
|
+
this.twitch = {
|
|
12567
12609
|
message(e = {}) {
|
|
12568
|
-
|
|
12569
|
-
e &&
|
|
12610
|
+
U.event.onEventReceived("twitch", "message", e).then((e) => {
|
|
12611
|
+
e && K.send("onEventReceived", e);
|
|
12570
12612
|
});
|
|
12571
12613
|
},
|
|
12572
12614
|
deleteMessage(e) {
|
|
@@ -12575,7 +12617,7 @@ var K = class extends e {
|
|
|
12575
12617
|
listener: "delete-message",
|
|
12576
12618
|
event: { msgId: e }
|
|
12577
12619
|
};
|
|
12578
|
-
|
|
12620
|
+
K.send("onEventReceived", t);
|
|
12579
12621
|
},
|
|
12580
12622
|
deleteMessages(e) {
|
|
12581
12623
|
if (!e || typeof e != "string") return;
|
|
@@ -12583,86 +12625,85 @@ var K = class extends e {
|
|
|
12583
12625
|
listener: "delete-messages",
|
|
12584
12626
|
event: { userId: e }
|
|
12585
12627
|
};
|
|
12586
|
-
|
|
12628
|
+
K.send("onEventReceived", t);
|
|
12587
12629
|
},
|
|
12588
12630
|
follower(e = {}) {
|
|
12589
|
-
|
|
12590
|
-
e &&
|
|
12631
|
+
U.event.onEventReceived("twitch", "follower-latest", e).then((e) => {
|
|
12632
|
+
e && K.send("onEventReceived", e);
|
|
12591
12633
|
});
|
|
12592
12634
|
},
|
|
12593
12635
|
raid(e = {}) {
|
|
12594
|
-
|
|
12595
|
-
e &&
|
|
12636
|
+
U.event.onEventReceived("twitch", "raid-latest", e).then((e) => {
|
|
12637
|
+
e && K.send("onEventReceived", e);
|
|
12596
12638
|
});
|
|
12597
12639
|
},
|
|
12598
12640
|
cheer(e = {}) {
|
|
12599
|
-
|
|
12600
|
-
e &&
|
|
12641
|
+
U.event.onEventReceived("twitch", "cheer-latest", e).then((e) => {
|
|
12642
|
+
e && K.send("onEventReceived", e);
|
|
12601
12643
|
});
|
|
12602
12644
|
},
|
|
12603
12645
|
subscriber(e = {}) {
|
|
12604
|
-
|
|
12605
|
-
e &&
|
|
12646
|
+
U.event.onEventReceived("twitch", "subscriber-latest", e).then((e) => {
|
|
12647
|
+
e && K.send("onEventReceived", e);
|
|
12606
12648
|
});
|
|
12607
12649
|
}
|
|
12608
|
-
},
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
e && q.emulate.send("onEventReceived", e);
|
|
12650
|
+
}, this.streamelements = { tip(e = {}) {
|
|
12651
|
+
U.event.onEventReceived("streamelements", "tip-latest", e).then((e) => {
|
|
12652
|
+
e && K.send("onEventReceived", e);
|
|
12612
12653
|
});
|
|
12613
|
-
} },
|
|
12614
|
-
youtube: {
|
|
12654
|
+
} }, this.youtube = {
|
|
12615
12655
|
message(e = {}) {
|
|
12616
|
-
|
|
12617
|
-
e &&
|
|
12656
|
+
U.event.onEventReceived("youtube", "message", e).then((e) => {
|
|
12657
|
+
e && K.send("onEventReceived", e);
|
|
12618
12658
|
});
|
|
12619
12659
|
},
|
|
12620
12660
|
subscriber(e = {}) {
|
|
12621
|
-
|
|
12622
|
-
e &&
|
|
12661
|
+
U.event.onEventReceived("youtube", "subscriber-latest", e).then((e) => {
|
|
12662
|
+
e && K.send("onEventReceived", e);
|
|
12623
12663
|
});
|
|
12624
12664
|
},
|
|
12625
12665
|
superchat(e = {}) {
|
|
12626
|
-
|
|
12627
|
-
e &&
|
|
12666
|
+
U.event.onEventReceived("youtube", "superchat-latest", e).then((e) => {
|
|
12667
|
+
e && K.send("onEventReceived", e);
|
|
12628
12668
|
});
|
|
12629
12669
|
},
|
|
12630
12670
|
sponsor(e = {}) {
|
|
12631
|
-
|
|
12632
|
-
e &&
|
|
12671
|
+
U.event.onEventReceived("youtube", "sponsor-latest", e).then((e) => {
|
|
12672
|
+
e && K.send("onEventReceived", e);
|
|
12633
12673
|
});
|
|
12634
12674
|
}
|
|
12635
|
-
},
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12641
|
-
return;
|
|
12642
|
-
}
|
|
12643
|
-
switch (e) {
|
|
12644
|
-
case "onEventReceived":
|
|
12645
|
-
q.queue.enqueue({
|
|
12646
|
-
listener: e,
|
|
12647
|
-
data: t,
|
|
12648
|
-
session: e === "onEventReceived" ? !0 : void 0
|
|
12649
|
-
});
|
|
12650
|
-
break;
|
|
12651
|
-
case "onSessionUpdate":
|
|
12652
|
-
q.queue.enqueue({
|
|
12653
|
-
listener: e,
|
|
12654
|
-
data: t
|
|
12655
|
-
});
|
|
12656
|
-
break;
|
|
12657
|
-
case "onWidgetLoad":
|
|
12658
|
-
q.queue.enqueue({
|
|
12659
|
-
listener: e,
|
|
12660
|
-
data: t
|
|
12661
|
-
});
|
|
12662
|
-
break;
|
|
12663
|
-
}
|
|
12675
|
+
}, this.kick = {}, this.facebook = {};
|
|
12676
|
+
}
|
|
12677
|
+
send(e, t) {
|
|
12678
|
+
if (!G) {
|
|
12679
|
+
Q.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
12680
|
+
return;
|
|
12664
12681
|
}
|
|
12665
|
-
|
|
12682
|
+
switch (e) {
|
|
12683
|
+
case "onEventReceived":
|
|
12684
|
+
G.enqueue({
|
|
12685
|
+
listener: e,
|
|
12686
|
+
data: t,
|
|
12687
|
+
session: e === "onEventReceived" ? !0 : void 0
|
|
12688
|
+
});
|
|
12689
|
+
break;
|
|
12690
|
+
case "onSessionUpdate":
|
|
12691
|
+
G.enqueue({
|
|
12692
|
+
listener: e,
|
|
12693
|
+
data: t
|
|
12694
|
+
});
|
|
12695
|
+
break;
|
|
12696
|
+
case "onWidgetLoad":
|
|
12697
|
+
G.enqueue({
|
|
12698
|
+
listener: e,
|
|
12699
|
+
data: t
|
|
12700
|
+
});
|
|
12701
|
+
break;
|
|
12702
|
+
}
|
|
12703
|
+
}
|
|
12704
|
+
}(), q;
|
|
12705
|
+
(function(e) {
|
|
12706
|
+
e.queue = G, e.generate = U, e.emulate = K;
|
|
12666
12707
|
async function t(e = [
|
|
12667
12708
|
"fields.json",
|
|
12668
12709
|
"cf.json",
|
|
@@ -12797,7 +12838,7 @@ var J = class {
|
|
|
12797
12838
|
timeEnd(e) {
|
|
12798
12839
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
12799
12840
|
}
|
|
12800
|
-
},
|
|
12841
|
+
}, ue = class extends e {
|
|
12801
12842
|
constructor(e, t) {
|
|
12802
12843
|
super(), this.isDebug = !1, this.init = !1, this.emulate = !1, this.username = e.username, this.password = e.password, this.channels = e.channels, this.isDebug = !!e.isDebug, this.init = !!e.init, this.emulate = t, this.load().then((e) => {
|
|
12803
12844
|
this.instance = e, this.emit("load", e), this.connect();
|
|
@@ -12969,7 +13010,7 @@ var J = class {
|
|
|
12969
13010
|
list: {}
|
|
12970
13011
|
}
|
|
12971
13012
|
};
|
|
12972
|
-
async function
|
|
13013
|
+
async function de() {
|
|
12973
13014
|
let e = localStorage.getItem("SE_API-STORE") ?? "", t = e ? JSON.parse(e) : {};
|
|
12974
13015
|
return Y.store.list = t, Y;
|
|
12975
13016
|
}
|
|
@@ -13024,40 +13065,40 @@ var X;
|
|
|
13024
13065
|
})(X ||= {});
|
|
13025
13066
|
//#endregion
|
|
13026
13067
|
//#region src/main.ts
|
|
13027
|
-
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(
|
|
13068
|
+
var Z = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(de()), Q = new J(), $ = {
|
|
13028
13069
|
SeAPI: Z,
|
|
13029
13070
|
Client: r,
|
|
13030
|
-
Helper:
|
|
13071
|
+
Helper: I,
|
|
13031
13072
|
Local: q,
|
|
13032
13073
|
Data: w,
|
|
13033
13074
|
logger: Q,
|
|
13034
13075
|
modules: {
|
|
13035
13076
|
EventProvider: e,
|
|
13036
13077
|
useStorage: n,
|
|
13037
|
-
useQueue:
|
|
13078
|
+
useQueue: W,
|
|
13038
13079
|
useLogger: J,
|
|
13039
|
-
useComms:
|
|
13040
|
-
FakeUserPool:
|
|
13080
|
+
useComms: se,
|
|
13081
|
+
FakeUserPool: ae
|
|
13041
13082
|
},
|
|
13042
13083
|
actions: {
|
|
13043
|
-
Button:
|
|
13044
|
-
Command:
|
|
13084
|
+
Button: R,
|
|
13085
|
+
Command: B
|
|
13045
13086
|
},
|
|
13046
|
-
multistream: { useComfyJs:
|
|
13087
|
+
multistream: { useComfyJs: ue },
|
|
13047
13088
|
internal: {
|
|
13048
13089
|
usedStorages: t,
|
|
13049
|
-
usedComms:
|
|
13050
|
-
usedCommands:
|
|
13051
|
-
usedButtons:
|
|
13052
|
-
fakeUserPools:
|
|
13090
|
+
usedComms: V,
|
|
13091
|
+
usedCommands: z,
|
|
13092
|
+
usedButtons: L,
|
|
13093
|
+
fakeUserPools: P
|
|
13053
13094
|
},
|
|
13054
13095
|
pronouns: { Alejo: X }
|
|
13055
13096
|
};
|
|
13056
13097
|
typeof window < "u" ? window.Tixyel = $ : globalThis.Tixyel = $;
|
|
13057
13098
|
//#endregion
|
|
13058
13099
|
//#region src/index.ts
|
|
13059
|
-
var
|
|
13100
|
+
var fe = $;
|
|
13060
13101
|
//#endregion
|
|
13061
|
-
export {
|
|
13102
|
+
export { fe as default };
|
|
13062
13103
|
|
|
13063
13104
|
//# sourceMappingURL=index.es.js.map
|