@tixyel/streamelements 5.0.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +298 -292
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class N {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.registeredEvents = {};
|
|
4
4
|
}
|
|
@@ -49,10 +49,10 @@ class R {
|
|
|
49
49
|
return this.registeredEvents[e] = [], this;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
var
|
|
53
|
-
class W extends
|
|
52
|
+
var L = [];
|
|
53
|
+
class W extends N {
|
|
54
54
|
constructor(e) {
|
|
55
|
-
super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = e.id || this.id, this.data = e.data ?? {},
|
|
55
|
+
super(), this.id = "default", this.loaded = !1, this.SE_API = null, this.id = e.id || this.id, this.data = e.data ?? {}, L.push(this), this.start();
|
|
56
56
|
}
|
|
57
57
|
start() {
|
|
58
58
|
it?.then((e) => {
|
|
@@ -112,7 +112,7 @@ class W extends R {
|
|
|
112
112
|
return e === "load" && this.loaded ? (t.apply(this, [this.data]), this) : (super.on(e, t), this);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
class E extends
|
|
115
|
+
class E extends N {
|
|
116
116
|
constructor(e) {
|
|
117
117
|
super(), this.id = "default", this.debug = !1, this.fields = {}, this.loaded = !1, this.actions = {
|
|
118
118
|
commands: [],
|
|
@@ -154,7 +154,7 @@ class E extends R {
|
|
|
154
154
|
]), this) : (super.on(e, t), this);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
class
|
|
157
|
+
class M {
|
|
158
158
|
constructor(e) {
|
|
159
159
|
this.prefix = "!", this.arguments = !1, this.test = `${this.prefix}${this.name} arg1 arg2`, this.aliases = [], this.permissions = void 0, this.admins = [], window.client instanceof E && (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"));
|
|
160
160
|
}
|
|
@@ -171,17 +171,17 @@ class P {
|
|
|
171
171
|
switch (t.provider) {
|
|
172
172
|
case "twitch": {
|
|
173
173
|
const c = t.data;
|
|
174
|
-
i = c.event.data.nick || c.event.data.displayName, c.event.data.tags?.badges && (n = c.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((
|
|
174
|
+
i = c.event.data.nick || c.event.data.displayName, c.event.data.tags?.badges && (n = c.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((h) => h in r ? r[h] : h));
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
case "youtube": {
|
|
178
|
-
const c = t.data,
|
|
178
|
+
const c = t.data, l = {
|
|
179
179
|
isVerified: "verified",
|
|
180
180
|
isChatOwner: "owner",
|
|
181
181
|
isChatSponsor: "sponsor",
|
|
182
182
|
isChatModerator: "moderator"
|
|
183
183
|
};
|
|
184
|
-
i = c.event.data.nick || c.event.data.displayName, n = Object.entries(c.event.data.authorDetails).filter(([
|
|
184
|
+
i = c.event.data.nick || c.event.data.displayName, n = Object.entries(c.event.data.authorDetails).filter(([h, p]) => h.startsWith("is") && p).map(([h]) => l[h]).filter(Boolean);
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
case "kick":
|
|
@@ -204,9 +204,9 @@ class P {
|
|
|
204
204
|
var n = [i.name, ...i.aliases ?? []], r = t.event.data.text.replace(i.prefix, "").split(" ")[0];
|
|
205
205
|
return n.includes(r);
|
|
206
206
|
});
|
|
207
|
-
if (a.length && a.every((i) => i instanceof
|
|
207
|
+
if (a.length && a.every((i) => i instanceof M))
|
|
208
208
|
return a.forEach((i) => {
|
|
209
|
-
i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"),
|
|
209
|
+
i.parse(t.event.data.text, e), window.client.emit("action", i, "executed"), C.received(`Command executed: ${t.event.data.text} by ${t.event.data.nick || t.event.data.displayName}`, t);
|
|
210
210
|
}), !0;
|
|
211
211
|
}
|
|
212
212
|
} catch {
|
|
@@ -242,9 +242,9 @@ class _ {
|
|
|
242
242
|
if (a.length && a.every((i) => i instanceof _))
|
|
243
243
|
return a.forEach((i) => {
|
|
244
244
|
try {
|
|
245
|
-
i.parse(e, t), window.client.emit("action", i, "executed"),
|
|
245
|
+
i.parse(e, t), window.client.emit("action", i, "executed"), C.received(`Button executed: ${e}${t ? ` with value: ${t}` : ""}`);
|
|
246
246
|
} catch (n) {
|
|
247
|
-
|
|
247
|
+
C.error(`Error executing button "${e}": ${n instanceof Error ? n.message : n}`);
|
|
248
248
|
}
|
|
249
249
|
}), !0;
|
|
250
250
|
}
|
|
@@ -280,51 +280,51 @@ const Y = {
|
|
|
280
280
|
if (s = Math.abs(Math.floor(s)), e === "suffix") {
|
|
281
281
|
const g = s % 100;
|
|
282
282
|
if (g >= 11 && g <= 13) return `${s}th`;
|
|
283
|
-
const
|
|
284
|
-
return `${s}${i[
|
|
283
|
+
const y = s % 10;
|
|
284
|
+
return `${s}${i[y]}`;
|
|
285
285
|
}
|
|
286
|
-
function o(g,
|
|
287
|
-
if (g < 10) return
|
|
288
|
-
if (g < 20) return
|
|
289
|
-
const
|
|
290
|
-
if (d === 0) return
|
|
291
|
-
const
|
|
292
|
-
return `${
|
|
286
|
+
function o(g, y) {
|
|
287
|
+
if (g < 10) return y === "ordinal" ? a.single[g] : t.single[g];
|
|
288
|
+
if (g < 20) return y === "ordinal" ? a.tens[g - 10] : t.tens[g - 10];
|
|
289
|
+
const b = Math.floor(g / 10), d = g % 10;
|
|
290
|
+
if (d === 0) return y === "ordinal" ? a.decades[b - 2] : t.decades[b - 2];
|
|
291
|
+
const m = t.decades[b - 2], k = y === "ordinal" ? a.single[d] : t.single[d];
|
|
292
|
+
return `${m}-${k}`;
|
|
293
293
|
}
|
|
294
|
-
function c(g,
|
|
295
|
-
if (g === 0) return
|
|
296
|
-
const
|
|
297
|
-
return
|
|
294
|
+
function c(g, y) {
|
|
295
|
+
if (g === 0) return y === "ordinal" ? a.single[0] : t.single[0];
|
|
296
|
+
const b = Math.floor(g / 100), d = g % 100, m = [];
|
|
297
|
+
return b > 0 && (y === "ordinal" && d === 0 ? m.push(`${t.single[b]} hundredth`) : m.push(`${t.single[b]} hundred`)), d > 0 && m.push(o(d, y)), m.join(" ");
|
|
298
298
|
}
|
|
299
299
|
if (s < 1e3) return c(s, e);
|
|
300
|
-
const
|
|
301
|
-
let
|
|
302
|
-
for (;
|
|
303
|
-
|
|
300
|
+
const l = [];
|
|
301
|
+
let h = s;
|
|
302
|
+
for (; h > 0; )
|
|
303
|
+
l.push(h % 1e3), h = Math.floor(h / 1e3);
|
|
304
304
|
let p = -1;
|
|
305
|
-
for (let g = 0; g <
|
|
306
|
-
const
|
|
307
|
-
for (let g =
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
305
|
+
for (let g = 0; g < l.length; g++) l[g] !== 0 && (p = g);
|
|
306
|
+
const f = [];
|
|
307
|
+
for (let g = l.length - 1; g >= 0; g--) {
|
|
308
|
+
const y = l[g];
|
|
309
|
+
if (y === 0) continue;
|
|
310
|
+
const b = n[g];
|
|
311
311
|
if (e === "cardinal") {
|
|
312
|
-
let d = c(
|
|
313
|
-
|
|
312
|
+
let d = c(y, "cardinal");
|
|
313
|
+
b && (d += ` ${b}`), f.push(d);
|
|
314
314
|
} else if (g === p)
|
|
315
315
|
if (g > 0) {
|
|
316
|
-
const
|
|
317
|
-
|
|
316
|
+
const m = c(y, "cardinal"), k = r[g];
|
|
317
|
+
f.push(m ? `${m} ${k}` : k);
|
|
318
318
|
} else {
|
|
319
|
-
const
|
|
320
|
-
|
|
319
|
+
const m = c(y, "ordinal");
|
|
320
|
+
f.push(m);
|
|
321
321
|
}
|
|
322
322
|
else {
|
|
323
|
-
let
|
|
324
|
-
|
|
323
|
+
let m = c(y, "cardinal");
|
|
324
|
+
b && (m += ` ${b}`), f.push(m);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
return f.join(", ");
|
|
328
328
|
},
|
|
329
329
|
/**
|
|
330
330
|
* Balances a number within a specified range
|
|
@@ -394,21 +394,21 @@ const Y = {
|
|
|
394
394
|
const { return: i = !1, parent: n, base: r } = a || {}, o = n || s.parentElement || document.body;
|
|
395
395
|
if (!o)
|
|
396
396
|
throw new Error("No parent element found for scaling");
|
|
397
|
-
const c = o.getBoundingClientRect(),
|
|
398
|
-
if (
|
|
397
|
+
const c = o.getBoundingClientRect(), l = s.offsetWidth, h = s.offsetHeight;
|
|
398
|
+
if (l === 0 || h === 0)
|
|
399
399
|
throw new Error("Element has zero width or height, cannot scale");
|
|
400
|
-
const p = c.width * t /
|
|
401
|
-
let g = r === "width" ? p : r === "height" ?
|
|
400
|
+
const p = c.width * t / l, f = c.height * t / h;
|
|
401
|
+
let g = r === "width" ? p : r === "height" ? f : Math.min(p, f);
|
|
402
402
|
if (e > 0) {
|
|
403
|
-
const
|
|
404
|
-
g = Math.max(
|
|
403
|
+
const b = c.width * e / l, d = c.height * e / h, m = Math.max(b, d);
|
|
404
|
+
g = Math.max(m, g);
|
|
405
405
|
}
|
|
406
|
-
const
|
|
407
|
-
width:
|
|
408
|
-
height:
|
|
406
|
+
const y = {
|
|
407
|
+
width: l * g,
|
|
408
|
+
height: h * g,
|
|
409
409
|
scale: g
|
|
410
410
|
};
|
|
411
|
-
return i || (s.style.transform = `scale(${g})`, s.style.transformOrigin = "center center"),
|
|
411
|
+
return i || (s.style.transform = `scale(${g})`, s.style.transformOrigin = "center center"), y;
|
|
412
412
|
},
|
|
413
413
|
/**
|
|
414
414
|
* Scales an HTML element to fit within its parent element based on specified options.
|
|
@@ -432,12 +432,12 @@ const Y = {
|
|
|
432
432
|
} } = e;
|
|
433
433
|
if (!t)
|
|
434
434
|
throw new Error("No parent element found for scaling");
|
|
435
|
-
const o = t.getBoundingClientRect(), c = s.getBoundingClientRect(),
|
|
436
|
-
let g =
|
|
437
|
-
const k = Math.max(g,
|
|
438
|
-
|
|
439
|
-
const v = p *
|
|
440
|
-
return a === "width" ?
|
|
435
|
+
const o = t.getBoundingClientRect(), c = s.getBoundingClientRect(), l = o.width, h = o.height, p = c.width, f = c.height;
|
|
436
|
+
let g = l * i / p, y = h * i / f, b = l * n / p, d = h * n / f, m = Math.min(b, d);
|
|
437
|
+
const k = Math.max(g, y);
|
|
438
|
+
m = Math.max(m, k);
|
|
439
|
+
const v = p * m, I = f * m;
|
|
440
|
+
return a === "width" ? m = Math.max(g, Math.min(b, l / p)) : a === "height" ? m = Math.max(y, Math.min(d, h / f)) : v > l ? m = Math.max(g, Math.min(b, l / p)) : I > h && (m = Math.max(y, Math.min(d, h / f))), r.apply(s, [m, s]), m;
|
|
441
441
|
},
|
|
442
442
|
/**
|
|
443
443
|
* Fits the text within the parent element by adjusting the font size.
|
|
@@ -459,47 +459,53 @@ const Y = {
|
|
|
459
459
|
}, n = t?.parent || s.parentElement;
|
|
460
460
|
if (!n)
|
|
461
461
|
throw new Error("No parent element found for fitting text");
|
|
462
|
-
const r = n.clientWidth * e, o = s.offsetWidth, c = r / o,
|
|
463
|
-
return s.style.fontSize =
|
|
462
|
+
const r = n.clientWidth * e, o = s.offsetWidth, c = r / o, l = a * c, h = Y.balance(l, i.minFontSize, i.maxFontSize);
|
|
463
|
+
return s.style.fontSize = h + "px", s;
|
|
464
464
|
},
|
|
465
465
|
/**
|
|
466
|
-
*
|
|
467
|
-
*
|
|
466
|
+
* Wraps formatted HTML text with containers and splits characters into indexed spans.
|
|
467
|
+
* Adds 'container' class and data-index to all parent elements, and wraps each character in a span with class 'char' and data-index.
|
|
468
|
+
* @param htmlString - The input HTML string containing formatted text elements (span, strong, em, etc).
|
|
468
469
|
* @param startIndex - The starting index for the data-index attribute (default is 0).
|
|
469
|
-
* @returns - A new HTML string with
|
|
470
|
+
* @returns - A new HTML string with containers and character-level indexing.
|
|
470
471
|
* @example
|
|
471
472
|
* ```javascript
|
|
472
|
-
* const result = splitTextToChars(
|
|
473
|
+
* const result = splitTextToChars('<span>TesTe</span> <strong>bold</strong>', 0);
|
|
473
474
|
* console.log(result);
|
|
474
|
-
* // Output: '<
|
|
475
|
+
* // Output: '<span class="container" data-index="0"><span class="char" data-index="0">T</span><span class="char" data-index="1">e</span>...'
|
|
475
476
|
* ```
|
|
476
477
|
*/
|
|
477
478
|
splitTextToChars(s, e = 0) {
|
|
478
479
|
const a = new DOMParser().parseFromString(s, "text/html");
|
|
479
480
|
let i = e;
|
|
480
|
-
function n(
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
const
|
|
484
|
-
return
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return c.cloneNode(!0);
|
|
481
|
+
function n(l) {
|
|
482
|
+
if (l.nodeType === Node.TEXT_NODE) {
|
|
483
|
+
const p = (l.textContent || "").split("").map((g, y) => {
|
|
484
|
+
const b = document.createElement("span");
|
|
485
|
+
return b.classList.add("char"), b.dataset.index = String(i), b.dataset.exclusivityIndex = String(i), b.style.setProperty("--char-index", String(i)), b.style.setProperty("--exclusivity-index", String(i)), (g === " " || g === `
|
|
486
|
+
` || g === " ") && (b.style.whiteSpace = "pre-wrap"), b.textContent = g, i++, b;
|
|
487
|
+
}), f = document.createDocumentFragment();
|
|
488
|
+
return p.forEach((g) => f.appendChild(g)), f;
|
|
489
|
+
} else if (l.nodeType === Node.ELEMENT_NODE) {
|
|
490
|
+
const h = l.cloneNode(!1);
|
|
491
|
+
return h.classList.add("container"), h.dataset.index = String(i), h.style.setProperty("--char-index", String(i)), l.childNodes.forEach((p) => {
|
|
492
|
+
const f = n(p);
|
|
493
|
+
(f instanceof DocumentFragment || f instanceof Node) && h.appendChild(f);
|
|
494
|
+
}), h;
|
|
495
|
+
}
|
|
496
|
+
return l.cloneNode(!0);
|
|
497
497
|
}
|
|
498
498
|
const r = a.body, o = document.createElement("div");
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
499
|
+
r.childNodes.forEach((l) => {
|
|
500
|
+
if (l.nodeType === Node.TEXT_NODE && !l.textContent?.trim())
|
|
501
|
+
return;
|
|
502
|
+
const h = n(l);
|
|
503
|
+
(h instanceof DocumentFragment || h instanceof Node) && o.appendChild(h);
|
|
504
|
+
});
|
|
505
|
+
let c = "";
|
|
506
|
+
return Array.from(o.childNodes).forEach((l) => {
|
|
507
|
+
l.nodeType === Node.TEXT_NODE ? c += l.textContent : c += l.outerHTML;
|
|
508
|
+
}), c;
|
|
503
509
|
}
|
|
504
510
|
}, Q = {
|
|
505
511
|
/**
|
|
@@ -544,8 +550,8 @@ const Y = {
|
|
|
544
550
|
}
|
|
545
551
|
if (Array.isArray(n)) {
|
|
546
552
|
n.forEach((o, c) => {
|
|
547
|
-
const
|
|
548
|
-
typeof o == "object" ? Object.assign(a, this.flatten(o, e,
|
|
553
|
+
const l = `${r}:${c}`;
|
|
554
|
+
typeof o == "object" ? Object.assign(a, this.flatten(o, e, l)) : a[l] = e ? String(o) : o;
|
|
549
555
|
});
|
|
550
556
|
continue;
|
|
551
557
|
}
|
|
@@ -835,7 +841,7 @@ function ot(s, e, t) {
|
|
|
835
841
|
if (e === 0)
|
|
836
842
|
a = i = n = t;
|
|
837
843
|
else {
|
|
838
|
-
const r = (
|
|
844
|
+
const r = (l, h, p) => (p < 0 && (p += 1), p > 1 && (p -= 1), p < 0.16666666666666666 ? l + (h - l) * 6 * p : p < 0.5 ? h : p < 0.6666666666666666 ? l + (h - l) * (0.6666666666666666 - p) * 6 : l), o = t < 0.5 ? t * (1 + e) : t + e - t * e, c = 2 * t - o;
|
|
839
845
|
a = r(c, o, s + 1 / 3), i = r(c, o, s), n = r(c, o, s - 1 / 3);
|
|
840
846
|
}
|
|
841
847
|
return {
|
|
@@ -853,8 +859,8 @@ async function ct(s, e, t) {
|
|
|
853
859
|
const c = o.getContext("2d");
|
|
854
860
|
if (!c) continue;
|
|
855
861
|
c.fillStyle = r, c.fillRect(0, 0, 1, 1);
|
|
856
|
-
const [
|
|
857
|
-
if (
|
|
862
|
+
const [l, h, p] = c.getImageData(0, 0, 1, 1).data, f = Math.sqrt(Math.pow(s - l, 2) + Math.pow(e - h, 2) + Math.pow(t - p, 2));
|
|
863
|
+
if (f < n && (n = f, i = r), f === 0) break;
|
|
858
864
|
}
|
|
859
865
|
return i;
|
|
860
866
|
}
|
|
@@ -1168,15 +1174,15 @@ const O = {
|
|
|
1168
1174
|
modifiers: {},
|
|
1169
1175
|
aliases: {}
|
|
1170
1176
|
}) {
|
|
1171
|
-
const { mergeSpanStyles: a } = X, i = (d,
|
|
1177
|
+
const { mergeSpanStyles: a } = X, i = (d, m, k) => t.html ? a(d, m, k) : m;
|
|
1172
1178
|
e.skip = "<br/>", e.newline = "<br/>";
|
|
1173
1179
|
const n = Object.entries(Q.flatten(e)).reduce(
|
|
1174
|
-
(d, [
|
|
1175
|
-
if (d[
|
|
1180
|
+
(d, [m, k]) => {
|
|
1181
|
+
if (d[m] = String(k), ["username", "name", "nick", "nickname", "sender"].some((v) => m === v)) {
|
|
1176
1182
|
const v = d?.username || d?.name || d?.nick || d?.nickname || d?.sender;
|
|
1177
1183
|
d.username = d.username || v, d.usernameAt = `@${d.username}`, d.name = d.name || v, d.nick = d.nick || v, d.nickname = d.nickname || v, d.sender = d.sender || v, d.senderAt = `@${d.sender}`;
|
|
1178
1184
|
}
|
|
1179
|
-
return ["amount", "count"].some((v) =>
|
|
1185
|
+
return ["amount", "count"].some((v) => m === v) && (d.amount = String(d?.amount || d.count || k), d.count = String(d?.count || d?.amount || k)), d.currency = d.currency || window?.client?.details.currency.symbol || "$", d.currencyCode = d.currencyCode || window?.client?.details.currency.code || "USD", d;
|
|
1180
1186
|
},
|
|
1181
1187
|
{}
|
|
1182
1188
|
), r = {
|
|
@@ -1185,8 +1191,8 @@ const O = {
|
|
|
1185
1191
|
};
|
|
1186
1192
|
var o = parseFloat(n?.amount ?? n?.count ?? 0);
|
|
1187
1193
|
const c = {
|
|
1188
|
-
COLOR: (d,
|
|
1189
|
-
WEIGHT: (d,
|
|
1194
|
+
COLOR: (d, m) => i(m && $.validate(m) ? `color: ${m}` : "", d, "color"),
|
|
1195
|
+
WEIGHT: (d, m) => i(m && !isNaN(parseInt(m)) ? `font-weight: ${m}` : "", d, "weight"),
|
|
1190
1196
|
BOLD: (d) => i("font-weight: bold", d, "bold"),
|
|
1191
1197
|
LIGHT: (d) => i("font-weight: lighter", d, "light"),
|
|
1192
1198
|
STRONG: (d) => i("font-weight: bolder", d, "strong"),
|
|
@@ -1197,9 +1203,9 @@ const O = {
|
|
|
1197
1203
|
SUP: (d) => i("vertical-align: super", d, "sup"),
|
|
1198
1204
|
LARGER: (d) => i("font-size: larger", d, "larger"),
|
|
1199
1205
|
SMALL: (d) => i("font-size: smaller", d, "small"),
|
|
1200
|
-
SHADOW: (d,
|
|
1201
|
-
SIZE: (d,
|
|
1202
|
-
},
|
|
1206
|
+
SHADOW: (d, m) => i(`text-shadow: ${m}`, d, "shadow"),
|
|
1207
|
+
SIZE: (d, m) => i(m ? `font-size: ${m}` : "", d, "size")
|
|
1208
|
+
}, h = {
|
|
1203
1209
|
...{
|
|
1204
1210
|
BT1: (d) => o > 1 ? d : "",
|
|
1205
1211
|
BT0: (d) => o > 0 ? d : "",
|
|
@@ -1209,7 +1215,7 @@ const O = {
|
|
|
1209
1215
|
LOW: (d) => d.toLowerCase(),
|
|
1210
1216
|
REV: (d) => d.split("").reverse().join(""),
|
|
1211
1217
|
CAP: (d) => d.charAt(0).toUpperCase() + d.slice(1).toLowerCase(),
|
|
1212
|
-
FALLBACK: (d,
|
|
1218
|
+
FALLBACK: (d, m) => d.length ? d : m ?? d
|
|
1213
1219
|
},
|
|
1214
1220
|
...t?.html ? c : {},
|
|
1215
1221
|
...t.modifiers ?? {}
|
|
@@ -1236,61 +1242,61 @@ const O = {
|
|
|
1236
1242
|
FALLBACK: ["FALLBACK", "FB"],
|
|
1237
1243
|
...t.aliases ?? {}
|
|
1238
1244
|
};
|
|
1239
|
-
function
|
|
1240
|
-
const v = Object.entries(p).find(([
|
|
1245
|
+
function f(d, m, k) {
|
|
1246
|
+
const v = Object.entries(p).find(([j, x]) => x.some((T) => T.toUpperCase() === m.toUpperCase()) ? !0 : j.toUpperCase() === m.toUpperCase()), I = v ? v[0] : m.toUpperCase();
|
|
1241
1247
|
try {
|
|
1242
|
-
return
|
|
1248
|
+
return h[I] ? h[I](d, typeof k == "string" ? k.trim() : null, n) : t?.html ? i("", d, I.toLowerCase()) : d;
|
|
1243
1249
|
} catch {
|
|
1244
1250
|
return d;
|
|
1245
1251
|
}
|
|
1246
1252
|
}
|
|
1247
1253
|
function g(d) {
|
|
1248
|
-
let
|
|
1249
|
-
for (; (k = r.MODIFIERS.exec(
|
|
1250
|
-
const [v, I,
|
|
1251
|
-
|
|
1254
|
+
let m = d, k;
|
|
1255
|
+
for (; (k = r.MODIFIERS.exec(m)) !== null; ) {
|
|
1256
|
+
const [v, I, j, x] = k, T = f(g(x), I, j);
|
|
1257
|
+
m = m.replace(v, T ?? ""), r.MODIFIERS.lastIndex = 0;
|
|
1252
1258
|
}
|
|
1253
|
-
return
|
|
1259
|
+
return m;
|
|
1254
1260
|
}
|
|
1255
|
-
function
|
|
1256
|
-
let
|
|
1261
|
+
function y(d) {
|
|
1262
|
+
let m = 0;
|
|
1257
1263
|
const k = d.length;
|
|
1258
|
-
function v(
|
|
1264
|
+
function v(j) {
|
|
1259
1265
|
let x = "";
|
|
1260
|
-
for (;
|
|
1261
|
-
if (d[
|
|
1262
|
-
|
|
1263
|
-
else if (d[
|
|
1266
|
+
for (; m < k; )
|
|
1267
|
+
if (d[m] === "\\")
|
|
1268
|
+
m + 1 < k ? (x += d[m + 1], m += 2) : m++;
|
|
1269
|
+
else if (d[m] === "[" && (!j || j !== "["))
|
|
1264
1270
|
x += I();
|
|
1265
|
-
else if (
|
|
1266
|
-
|
|
1271
|
+
else if (j && d[m] === j) {
|
|
1272
|
+
m++;
|
|
1267
1273
|
break;
|
|
1268
1274
|
} else
|
|
1269
|
-
x += d[
|
|
1275
|
+
x += d[m++];
|
|
1270
1276
|
return x;
|
|
1271
1277
|
}
|
|
1272
1278
|
function I() {
|
|
1273
|
-
|
|
1274
|
-
let
|
|
1275
|
-
for (;
|
|
1279
|
+
m++;
|
|
1280
|
+
let j = "";
|
|
1281
|
+
for (; m < k && /[A-Za-z0-9]/.test(d[m]); ) j += d[m++];
|
|
1276
1282
|
let x = null;
|
|
1277
|
-
if (d[
|
|
1278
|
-
|
|
1279
|
-
const D =
|
|
1280
|
-
for (;
|
|
1281
|
-
x = d.slice(D,
|
|
1283
|
+
if (d[m] === ":") {
|
|
1284
|
+
m++;
|
|
1285
|
+
const D = m;
|
|
1286
|
+
for (; m < k && d[m] !== "="; ) m++;
|
|
1287
|
+
x = d.slice(D, m);
|
|
1282
1288
|
}
|
|
1283
|
-
d[
|
|
1289
|
+
d[m] === "=" && m++;
|
|
1284
1290
|
const T = v("]");
|
|
1285
|
-
return
|
|
1291
|
+
return f(T, j, x);
|
|
1286
1292
|
}
|
|
1287
1293
|
return v();
|
|
1288
1294
|
}
|
|
1289
|
-
let
|
|
1295
|
+
let b = s.replace(
|
|
1290
1296
|
r.PLACEHOLDERS,
|
|
1291
|
-
(d,
|
|
1297
|
+
(d, m) => typeof n[m] == "string" || typeof n[m] == "number" ? String(n[m]) : m ?? m
|
|
1292
1298
|
);
|
|
1293
|
-
return
|
|
1299
|
+
return b = t.method === "loop" ? g(b) : y(b), b;
|
|
1294
1300
|
}
|
|
1295
1301
|
}, ht = [
|
|
1296
1302
|
"https://static-cdn.jtvnw.net/user-default-pictures-uv/13e5fa74-defa-11e9-809c-784f43822e80-profile_image-300x300.png",
|
|
@@ -2887,7 +2893,7 @@ const O = {
|
|
|
2887
2893
|
"Szabolcs",
|
|
2888
2894
|
"Hoda",
|
|
2889
2895
|
"Naayf"
|
|
2890
|
-
],
|
|
2896
|
+
], yt = [
|
|
2891
2897
|
{
|
|
2892
2898
|
emojiId: "UCkszU2WH9gy1mb0dV-11UJg/flower-rainbow-heart-red",
|
|
2893
2899
|
shortcuts: [":pride-flower-rainbow-heart:"],
|
|
@@ -6061,18 +6067,18 @@ const O = {
|
|
|
6061
6067
|
index: 121
|
|
6062
6068
|
}
|
|
6063
6069
|
];
|
|
6064
|
-
var
|
|
6070
|
+
var w;
|
|
6065
6071
|
((s) => {
|
|
6066
|
-
s.avatars = ht, s.badges = lt, s.css_color_names = V, s.emotes = mt, s.items = ut, s.messages = gt, s.names = pt, s.tiers = ft, s.tts = bt, s.youtube_emotes =
|
|
6067
|
-
})(
|
|
6068
|
-
const
|
|
6072
|
+
s.avatars = ht, s.badges = lt, s.css_color_names = V, s.emotes = mt, s.items = ut, s.messages = gt, s.names = pt, s.tiers = ft, s.tts = bt, s.youtube_emotes = yt;
|
|
6073
|
+
})(w || (w = {}));
|
|
6074
|
+
const wt = {
|
|
6069
6075
|
/**
|
|
6070
6076
|
* Finds emotes in a given text.
|
|
6071
6077
|
* @param text - The text to search for emotes.
|
|
6072
6078
|
* @param emotes - An array of emotes to search for. Defaults to Local data emotes.
|
|
6073
6079
|
* @returns An array of emotes found in the text with their positions.
|
|
6074
6080
|
*/
|
|
6075
|
-
findEmotesInText(s, e =
|
|
6081
|
+
findEmotesInText(s, e = w.emotes) {
|
|
6076
6082
|
const t = [];
|
|
6077
6083
|
return e.forEach((a) => {
|
|
6078
6084
|
const i = a.name;
|
|
@@ -6080,8 +6086,8 @@ const yt = {
|
|
|
6080
6086
|
for (; n < s.length; ) {
|
|
6081
6087
|
const o = s.indexOf(i, r);
|
|
6082
6088
|
if (o === -1) break;
|
|
6083
|
-
const c = o > 0 ? s[o - 1] : " ",
|
|
6084
|
-
/\s/.test(c) && /\s/.test(
|
|
6089
|
+
const c = o > 0 ? s[o - 1] : " ", l = o + i.length < s.length ? s[o + i.length] : " ";
|
|
6090
|
+
/\s/.test(c) && /\s/.test(l) && t.push({ ...a, start: o, end: o + i.length }), r = o + 1;
|
|
6085
6091
|
}
|
|
6086
6092
|
}), t.sort((a, i) => a.start - i.start);
|
|
6087
6093
|
},
|
|
@@ -6106,7 +6112,7 @@ const yt = {
|
|
|
6106
6112
|
* @param emotes - An array of YouTube emotes. Defaults to Local data YouTube emotes.
|
|
6107
6113
|
* @returns The text with YouTube emotes replaced by HTML image tags.
|
|
6108
6114
|
*/
|
|
6109
|
-
replaceYoutubeEmotesWithHTML(s, e =
|
|
6115
|
+
replaceYoutubeEmotesWithHTML(s, e = w.youtube_emotes) {
|
|
6110
6116
|
return Array.from(s.matchAll(/:(.*?):/gim), (a) => a[0]).forEach((a) => {
|
|
6111
6117
|
const i = e.find((n) => n.shortcuts.includes(a) || n.searchTerms.includes(a.slice(1, -1)));
|
|
6112
6118
|
if (i) {
|
|
@@ -6132,7 +6138,7 @@ const yt = {
|
|
|
6132
6138
|
if (!Array.isArray(s) && typeof s == "string" && (s = s.split(",").map((r) => r.trim())), !s || !s.length) {
|
|
6133
6139
|
var t = O.number(1, 3);
|
|
6134
6140
|
for await (const r of Array.from({ length: t }, () => "")) {
|
|
6135
|
-
var a = O.array(Object.keys(
|
|
6141
|
+
var a = O.array(Object.keys(w.badges))[0];
|
|
6136
6142
|
!s.includes(a) && Array.isArray(s) ? s.push(a) : s = [a];
|
|
6137
6143
|
}
|
|
6138
6144
|
}
|
|
@@ -6140,8 +6146,8 @@ const yt = {
|
|
|
6140
6146
|
switch (e) {
|
|
6141
6147
|
case "twitch": {
|
|
6142
6148
|
i = {
|
|
6143
|
-
keys: Array.from(s).filter((r) => r in
|
|
6144
|
-
badges: Array.from(s).slice(0, 3).map((r) =>
|
|
6149
|
+
keys: Array.from(s).filter((r) => r in w.badges),
|
|
6150
|
+
badges: Array.from(s).slice(0, 3).map((r) => w.badges[r]).filter(Boolean)
|
|
6145
6151
|
};
|
|
6146
6152
|
break;
|
|
6147
6153
|
}
|
|
@@ -6183,18 +6189,18 @@ const yt = {
|
|
|
6183
6189
|
};
|
|
6184
6190
|
var u;
|
|
6185
6191
|
((s) => {
|
|
6186
|
-
s.sound = st, s.element = X, s.color = $, s.object = Q, s.utils = Z, s.random = O, s.number = Y, s.string = dt, s.message =
|
|
6192
|
+
s.sound = st, s.element = X, s.color = $, s.object = Q, s.utils = Z, s.random = O, s.number = Y, s.string = dt, s.message = wt, s.event = vt;
|
|
6187
6193
|
})(u || (u = {}));
|
|
6188
6194
|
var U;
|
|
6189
6195
|
((s) => {
|
|
6190
6196
|
s.generate = {
|
|
6191
6197
|
session: {
|
|
6192
6198
|
types: {
|
|
6193
|
-
name: { type: "string", options:
|
|
6194
|
-
tier: { type: "string", options:
|
|
6195
|
-
message: { type: "string", options:
|
|
6196
|
-
item: { type: "array", options:
|
|
6197
|
-
avatar: { type: "string", options:
|
|
6199
|
+
name: { type: "string", options: w.names.filter((t) => t.length) },
|
|
6200
|
+
tier: { type: "string", options: w.tiers.filter((t) => t.length) },
|
|
6201
|
+
message: { type: "string", options: w.messages.filter((t) => t.length) },
|
|
6202
|
+
item: { type: "array", options: w.items },
|
|
6203
|
+
avatar: { type: "string", options: w.avatars.filter((t) => t.length) }
|
|
6198
6204
|
},
|
|
6199
6205
|
available() {
|
|
6200
6206
|
const t = this.types;
|
|
@@ -6443,43 +6449,43 @@ var U;
|
|
|
6443
6449
|
const a = this.available();
|
|
6444
6450
|
if (t) return t;
|
|
6445
6451
|
const i = (r) => {
|
|
6446
|
-
const o = (
|
|
6447
|
-
if (!
|
|
6452
|
+
const o = (h) => {
|
|
6453
|
+
if (!h || !("amount" in h)) return [];
|
|
6448
6454
|
const p = [];
|
|
6449
|
-
for (let
|
|
6450
|
-
p.push(i(
|
|
6451
|
-
return p.sort((
|
|
6452
|
-
}, c = (
|
|
6455
|
+
for (let f = 0; f < h.amount; f++)
|
|
6456
|
+
p.push(i(h.value));
|
|
6457
|
+
return p.sort((f, g) => new Date(g.createdAt).getTime() - new Date(f.createdAt).getTime());
|
|
6458
|
+
}, c = (h) => {
|
|
6453
6459
|
const p = {};
|
|
6454
|
-
for (const
|
|
6455
|
-
const g =
|
|
6456
|
-
p[g] = i(
|
|
6460
|
+
for (const f in h) {
|
|
6461
|
+
const g = f.replace("_type", "type");
|
|
6462
|
+
p[g] = i(h[f]);
|
|
6457
6463
|
}
|
|
6458
6464
|
return p;
|
|
6459
|
-
},
|
|
6460
|
-
if (!
|
|
6461
|
-
switch (
|
|
6465
|
+
}, l = (h) => {
|
|
6466
|
+
if (!h) return h;
|
|
6467
|
+
switch (h.type) {
|
|
6462
6468
|
case "int":
|
|
6463
|
-
return u.random.number(
|
|
6469
|
+
return u.random.number(h.min, h.max);
|
|
6464
6470
|
case "string":
|
|
6465
|
-
return u.random.array(
|
|
6471
|
+
return u.random.array(h.options)[0];
|
|
6466
6472
|
case "date":
|
|
6467
|
-
return u.random.daysOffset(
|
|
6473
|
+
return u.random.daysOffset(h.range);
|
|
6468
6474
|
case "array":
|
|
6469
|
-
return u.random.array(
|
|
6475
|
+
return u.random.array(h.options)[0];
|
|
6470
6476
|
case "recent":
|
|
6471
|
-
return o(
|
|
6477
|
+
return o(h);
|
|
6472
6478
|
default:
|
|
6473
|
-
return
|
|
6479
|
+
return h;
|
|
6474
6480
|
}
|
|
6475
6481
|
};
|
|
6476
|
-
return typeof r != "object" || r === null ? r : "type" in r && typeof r.type == "string" ?
|
|
6482
|
+
return typeof r != "object" || r === null ? r : "type" in r && typeof r.type == "string" ? l(r) : c(r);
|
|
6477
6483
|
};
|
|
6478
6484
|
var n = Object.entries(i(a)).reduce(
|
|
6479
6485
|
(r, [o, c]) => (Object.entries(c).forEach(
|
|
6480
|
-
([
|
|
6486
|
+
([l, h]) => (
|
|
6481
6487
|
//
|
|
6482
|
-
r[`${o}-${
|
|
6488
|
+
r[`${o}-${l}`] = h
|
|
6483
6489
|
)
|
|
6484
6490
|
), r),
|
|
6485
6491
|
{}
|
|
@@ -6542,17 +6548,17 @@ var U;
|
|
|
6542
6548
|
case "cheer-latest": {
|
|
6543
6549
|
const r = n.event.amount, o = n.event.displayName ?? n.event.name, c = n.event.message;
|
|
6544
6550
|
t["cheer-latest"] = { name: o, amount: r, message: c };
|
|
6545
|
-
const
|
|
6546
|
-
if (
|
|
6547
|
-
|
|
6551
|
+
const l = (h) => {
|
|
6552
|
+
if (h === "all") {
|
|
6553
|
+
l("alltime"), l("monthly"), l("weekly"), l("session");
|
|
6548
6554
|
return;
|
|
6549
6555
|
}
|
|
6550
|
-
const p = t[`cheer-${
|
|
6556
|
+
const p = t[`cheer-${h}-top-donation`];
|
|
6551
6557
|
p && r > p.amount && (p.amount = r, p.name = o);
|
|
6552
|
-
const
|
|
6553
|
-
|
|
6558
|
+
const f = t[`cheer-${h}-top-donator`], g = t["cheer-recent"].filter((b) => b.name.toLowerCase() === f.name.toLowerCase()).reduce((b, d) => b + d.amount, 0), y = t["cheer-recent"].filter((b) => b.name.toLowerCase() === o.toLowerCase()).reduce((b, d) => b + d.amount, 0);
|
|
6559
|
+
y > g && (f.amount = y, f.name = o);
|
|
6554
6560
|
};
|
|
6555
|
-
|
|
6561
|
+
l("all"), t["cheer-session"].amount += r, t["cheer-week"].amount += r, t["cheer-month"].amount += r, t["cheer-total"].amount += r, t["cheer-count"].count += 1, t["cheer-goal"].amount += r, t["cheer-recent"].unshift({ name: o, amount: r, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["cheer-recent"] = (t["cheer-recent"] || []).sort(i);
|
|
6556
6562
|
break;
|
|
6557
6563
|
}
|
|
6558
6564
|
case "follower-latest": {
|
|
@@ -6561,16 +6567,16 @@ var U;
|
|
|
6561
6567
|
break;
|
|
6562
6568
|
}
|
|
6563
6569
|
case "subscriber-latest": {
|
|
6564
|
-
const r = n.event.displayName ?? n.event.name, o = n.event.amount, c = n.event.tier,
|
|
6565
|
-
if (t["subscriber-latest"] = { name: r, amount: o, tier: c, message:
|
|
6566
|
-
const
|
|
6570
|
+
const r = n.event.displayName ?? n.event.name, o = n.event.amount, c = n.event.tier, l = n.event.message;
|
|
6571
|
+
if (t["subscriber-latest"] = { name: r, amount: o, tier: c, message: l ?? "" }, t["subscriber-recent"].find((h) => h.name.toLowerCase() === r.toLowerCase()) ? o > 1 && (t["subscriber-resub-latest"] = { name: r, amount: o, message: l ?? "" }, t["subscriber-resub-session"].count += 1) : (t["subscriber-new-latest"] = { name: r, amount: o, message: l ?? "" }, t["subscriber-new-session"].count += 1), !(!n.event.gifted && !n.event.bulkGifted && !n.event.isCommunityGift)) if (n.event.gifted && !n.event.bulkGifted && !n.event.isCommunityGift) {
|
|
6572
|
+
const h = n.event.sender;
|
|
6567
6573
|
t["subscriber-gifted-latest"] = {
|
|
6568
6574
|
name: r,
|
|
6569
6575
|
amount: o,
|
|
6570
6576
|
tier: c,
|
|
6571
|
-
message:
|
|
6572
|
-
sender:
|
|
6573
|
-
}, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name:
|
|
6577
|
+
message: l ?? "",
|
|
6578
|
+
sender: h
|
|
6579
|
+
}, t["subscriber-gifted-session"].count += 1, t["subscriber-alltime-gifter"] = { name: h, amount: o };
|
|
6574
6580
|
} else n.event.gifted && !n.event.bulkGifted && n.event.isCommunityGift || !n.event.gifted && n.event.bulkGifted && n.event.isCommunityGift;
|
|
6575
6581
|
t["subscriber-session"].count += o, t["subscriber-week"].count += o, t["subscriber-month"].count += o, t["subscriber-total"].count += o, t["subscriber-goal"].amount += o, t["subscriber-points"].amount += o, t["subscriber-recent"].unshift({ name: r, amount: o, tier: c, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["subscriber-recent"] = (t["subscriber-recent"] || []).sort(i);
|
|
6576
6582
|
break;
|
|
@@ -6599,15 +6605,15 @@ var U;
|
|
|
6599
6605
|
providerId: "",
|
|
6600
6606
|
avatar: ""
|
|
6601
6607
|
};
|
|
6602
|
-
const c = (
|
|
6603
|
-
if (
|
|
6608
|
+
const c = (l) => {
|
|
6609
|
+
if (l === "all") {
|
|
6604
6610
|
c("alltime"), c("monthly"), c("weekly"), c("session");
|
|
6605
6611
|
return;
|
|
6606
6612
|
}
|
|
6607
|
-
const
|
|
6608
|
-
|
|
6609
|
-
const p = t[`superchat-${
|
|
6610
|
-
g >
|
|
6613
|
+
const h = t[`superchat-${l}-top-donation`];
|
|
6614
|
+
h && o > h.amount && (h.amount = o, h.name = r);
|
|
6615
|
+
const p = t[`superchat-${l}-top-donator`], f = t["superchat-recent"].filter((y) => y.name.toLowerCase() === p.name.toLowerCase()).reduce((y, b) => y + b.amount, 0), g = t["superchat-recent"].filter((y) => y.name.toLowerCase() === r.toLowerCase()).reduce((y, b) => y + b.amount, 0);
|
|
6616
|
+
g > f && (p.amount = g, p.name = r);
|
|
6611
6617
|
};
|
|
6612
6618
|
c("all"), t["superchat-session"].amount += o, t["superchat-week"].amount += o, t["superchat-month"].amount += o, t["superchat-total"].amount += o, t["superchat-count"].count += 1, t["superchat-goal"].amount += o, t["superchat-recent"].unshift({
|
|
6613
6619
|
name: r.toLowerCase(),
|
|
@@ -6631,15 +6637,15 @@ var U;
|
|
|
6631
6637
|
case "tip-latest": {
|
|
6632
6638
|
const r = n.event.displayName ?? n.event.name, o = n.event.amount;
|
|
6633
6639
|
t["tip-latest"] = { name: r, amount: o };
|
|
6634
|
-
const c = (
|
|
6635
|
-
if (
|
|
6640
|
+
const c = (l) => {
|
|
6641
|
+
if (l === "all") {
|
|
6636
6642
|
c("alltime"), c("monthly"), c("weekly"), c("session");
|
|
6637
6643
|
return;
|
|
6638
6644
|
}
|
|
6639
|
-
const
|
|
6640
|
-
|
|
6641
|
-
const p = t[`tip-${
|
|
6642
|
-
g >
|
|
6645
|
+
const h = t[`tip-${l}-top-donation`];
|
|
6646
|
+
h && o > h.amount && (h.amount = o, h.name = r);
|
|
6647
|
+
const p = t[`tip-${l}-top-donator`], f = t["tip-recent"].filter((y) => y.name.toLowerCase() === p.name.toLowerCase()).reduce((y, b) => y + b.amount, 0), g = t["tip-recent"].filter((y) => y.name.toLowerCase() === r.toLowerCase()).reduce((y, b) => y + b.amount, 0);
|
|
6648
|
+
g > f && (p.amount = g, p.name = r);
|
|
6643
6649
|
};
|
|
6644
6650
|
c("all"), t["tip-session"].amount += o, t["tip-week"].amount += o, t["tip-month"].amount += o, t["tip-total"].amount += o, t["tip-count"].count += 1, t["tip-goal"].amount += o, t["tip-recent"].unshift({ name: r, amount: o, createdAt: (/* @__PURE__ */ new Date()).toISOString() }), t["tip-recent"] = (t["tip-recent"] || []).sort(i);
|
|
6645
6651
|
break;
|
|
@@ -6688,7 +6694,7 @@ var U;
|
|
|
6688
6694
|
return this.onEventReceived(t, o);
|
|
6689
6695
|
}
|
|
6690
6696
|
case "message": {
|
|
6691
|
-
var c = i?.name ?? u.random.array(
|
|
6697
|
+
var c = i?.name ?? u.random.array(w.names.filter((P) => P.length))[0], l = i?.message ?? u.random.array(w.messages.filter((P) => P.length))[0], h = await u.message.generateBadges(i?.badges ?? [], t), p = u.message.findEmotesInText(l), f = u.message.replaceEmotesWithHTML(l, p), g = i?.color ?? u.random.color("hex"), y = i?.userId ?? u.random.number(1e7, 99999999).toString(), b = i?.msgId ?? u.random.uuid(), d = i?.time ?? Date.now(), m = i?.channel ?? client.details.user.username;
|
|
6692
6698
|
return {
|
|
6693
6699
|
listener: "message",
|
|
6694
6700
|
event: {
|
|
@@ -6696,41 +6702,41 @@ var U;
|
|
|
6696
6702
|
data: {
|
|
6697
6703
|
time: d,
|
|
6698
6704
|
tags: {
|
|
6699
|
-
"badge-info": `${
|
|
6700
|
-
badges:
|
|
6701
|
-
mod:
|
|
6702
|
-
subscriber:
|
|
6703
|
-
turbo:
|
|
6705
|
+
"badge-info": `${h.keys.map((P) => `${P}/${u.random.number(1, 5)}`).join(",")}`,
|
|
6706
|
+
badges: h.keys.join("/1,"),
|
|
6707
|
+
mod: h.keys.includes("moderator") ? "1" : "0",
|
|
6708
|
+
subscriber: h.keys.includes("subscriber") ? "1" : "0",
|
|
6709
|
+
turbo: h.keys.includes("turbo") ? "1" : "0",
|
|
6704
6710
|
"tmi-sent-ts": d.toString(),
|
|
6705
|
-
"user-id":
|
|
6711
|
+
"user-id": y,
|
|
6706
6712
|
"user-type": "",
|
|
6707
6713
|
color: g,
|
|
6708
6714
|
"display-name": c,
|
|
6709
6715
|
emotes: "",
|
|
6710
6716
|
"client-nonce": u.random.string(16),
|
|
6711
6717
|
flags: "",
|
|
6712
|
-
id:
|
|
6718
|
+
id: b,
|
|
6713
6719
|
"first-msg": "0",
|
|
6714
6720
|
"returning-chatter": "0"
|
|
6715
6721
|
},
|
|
6716
6722
|
nick: c.toLowerCase(),
|
|
6717
6723
|
displayName: c,
|
|
6718
6724
|
displayColor: g,
|
|
6719
|
-
channel:
|
|
6720
|
-
text:
|
|
6725
|
+
channel: m,
|
|
6726
|
+
text: l,
|
|
6721
6727
|
isAction: !1,
|
|
6722
|
-
userId:
|
|
6723
|
-
msgId:
|
|
6724
|
-
badges:
|
|
6728
|
+
userId: y,
|
|
6729
|
+
msgId: b,
|
|
6730
|
+
badges: h.badges,
|
|
6725
6731
|
emotes: p
|
|
6726
6732
|
},
|
|
6727
|
-
renderedText:
|
|
6733
|
+
renderedText: f
|
|
6728
6734
|
}
|
|
6729
6735
|
};
|
|
6730
6736
|
}
|
|
6731
6737
|
case "cheer":
|
|
6732
6738
|
case "cheer-latest": {
|
|
6733
|
-
var k = i?.amount ?? u.random.number(100, 1e4), v = i?.avatar ?? u.random.array(
|
|
6739
|
+
var k = i?.amount ?? u.random.number(100, 1e4), v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((S) => S.length))[0], l = i?.message ?? u.random.array(w.messages.filter((S) => S.length))[0];
|
|
6734
6740
|
return {
|
|
6735
6741
|
listener: "cheer-latest",
|
|
6736
6742
|
event: {
|
|
@@ -6738,7 +6744,7 @@ var U;
|
|
|
6738
6744
|
avatar: v,
|
|
6739
6745
|
name: c.toLowerCase(),
|
|
6740
6746
|
displayName: c,
|
|
6741
|
-
message:
|
|
6747
|
+
message: l,
|
|
6742
6748
|
providerId: "",
|
|
6743
6749
|
_id: u.random.uuid(),
|
|
6744
6750
|
sessionTop: !1,
|
|
@@ -6750,7 +6756,7 @@ var U;
|
|
|
6750
6756
|
}
|
|
6751
6757
|
case "follower":
|
|
6752
6758
|
case "follower-latest": {
|
|
6753
|
-
var v = i?.avatar ?? u.random.array(
|
|
6759
|
+
var v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((S) => S.length))[0];
|
|
6754
6760
|
return {
|
|
6755
6761
|
listener: "follower-latest",
|
|
6756
6762
|
event: {
|
|
@@ -6768,7 +6774,7 @@ var U;
|
|
|
6768
6774
|
}
|
|
6769
6775
|
case "raid":
|
|
6770
6776
|
case "raid-latest": {
|
|
6771
|
-
var k = i?.amount ?? u.random.number(1, 100), v = i?.avatar ?? u.random.array(
|
|
6777
|
+
var k = i?.amount ?? u.random.number(1, 100), v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((A) => A.length))[0];
|
|
6772
6778
|
return {
|
|
6773
6779
|
listener: "raid-latest",
|
|
6774
6780
|
event: {
|
|
@@ -6787,22 +6793,22 @@ var U;
|
|
|
6787
6793
|
}
|
|
6788
6794
|
case "subscriber":
|
|
6789
6795
|
case "subscriber-latest": {
|
|
6790
|
-
var I = i?.tier ?? u.random.array(["1000", "2000", "3000", "prime"])[0], k = i?.amount ?? u.random.number(1, 24), v = i?.avatar ?? u.random.array(
|
|
6796
|
+
var I = i?.tier ?? u.random.array(["1000", "2000", "3000", "prime"])[0], k = i?.amount ?? u.random.number(1, 24), v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((z) => z.length))[0], j = i?.sender ?? u.random.array(w.names.filter((z) => z.length && z !== c))[0], l = i?.message ?? u.random.array(w.messages.filter((z) => z.length))[0], x = {
|
|
6791
6797
|
default: {
|
|
6792
6798
|
avatar: v,
|
|
6793
6799
|
playedAsCommunityGift: !1
|
|
6794
6800
|
},
|
|
6795
6801
|
gift: {
|
|
6796
|
-
sender:
|
|
6802
|
+
sender: j,
|
|
6797
6803
|
gifted: !0
|
|
6798
6804
|
},
|
|
6799
6805
|
community: {
|
|
6800
|
-
message:
|
|
6801
|
-
sender:
|
|
6806
|
+
message: l,
|
|
6807
|
+
sender: j,
|
|
6802
6808
|
bulkGifted: !0
|
|
6803
6809
|
},
|
|
6804
6810
|
spam: {
|
|
6805
|
-
sender:
|
|
6811
|
+
sender: j,
|
|
6806
6812
|
gifted: !0,
|
|
6807
6813
|
isCommunityGift: !0
|
|
6808
6814
|
}
|
|
@@ -6851,7 +6857,7 @@ var U;
|
|
|
6851
6857
|
}
|
|
6852
6858
|
case "tip":
|
|
6853
6859
|
case "tip-latest": {
|
|
6854
|
-
var k = i?.amount ?? u.random.number(100, 4e3), v = i?.avatar ?? u.random.array(
|
|
6860
|
+
var k = i?.amount ?? u.random.number(100, 4e3), v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((A) => A.length))[0];
|
|
6855
6861
|
return {
|
|
6856
6862
|
listener: "tip-latest",
|
|
6857
6863
|
event: {
|
|
@@ -6917,9 +6923,9 @@ var U;
|
|
|
6917
6923
|
return this.onEventReceived(t, o);
|
|
6918
6924
|
}
|
|
6919
6925
|
case "message": {
|
|
6920
|
-
var c = i?.name ?? u.random.array(
|
|
6921
|
-
const
|
|
6922
|
-
var p = u.message.findEmotesInText(
|
|
6926
|
+
var c = i?.name ?? u.random.array(w.names.filter((q) => q.length))[0], l = i?.message ?? u.random.array(w.messages.filter((q) => q.length))[0];
|
|
6927
|
+
const R = await u.message.generateBadges(i?.badges ?? [], t);
|
|
6928
|
+
var p = u.message.findEmotesInText(l), f = u.message.replaceEmotesWithHTML(l, p), g = i?.color ?? u.random.color("hex"), y = i?.userId ?? u.random.number(1e7, 99999999).toString(), b = i?.msgId ?? u.random.uuid(), d = i?.time ?? Date.now(), v = i?.avatar ?? u.random.array(w.avatars)[0], m = i?.channel ?? client.details.user.username;
|
|
6923
6929
|
return {
|
|
6924
6930
|
listener: "message",
|
|
6925
6931
|
event: {
|
|
@@ -6931,23 +6937,23 @@ var U;
|
|
|
6931
6937
|
snippet: {
|
|
6932
6938
|
type: "",
|
|
6933
6939
|
liveChatId: "",
|
|
6934
|
-
authorChannelId:
|
|
6940
|
+
authorChannelId: m,
|
|
6935
6941
|
publishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6936
6942
|
hasDisplayContent: !0,
|
|
6937
|
-
displayMessage:
|
|
6943
|
+
displayMessage: l,
|
|
6938
6944
|
textMessageDetails: {
|
|
6939
|
-
messageText:
|
|
6945
|
+
messageText: l
|
|
6940
6946
|
}
|
|
6941
6947
|
},
|
|
6942
6948
|
authorDetails: {
|
|
6943
|
-
channelId:
|
|
6949
|
+
channelId: m,
|
|
6944
6950
|
channelUrl: "",
|
|
6945
6951
|
displayName: c,
|
|
6946
6952
|
profileImageUrl: v,
|
|
6947
|
-
...
|
|
6953
|
+
...R
|
|
6948
6954
|
},
|
|
6949
|
-
msgId:
|
|
6950
|
-
userId:
|
|
6955
|
+
msgId: b,
|
|
6956
|
+
userId: y,
|
|
6951
6957
|
nick: c.toLowerCase(),
|
|
6952
6958
|
badges: [],
|
|
6953
6959
|
displayName: c,
|
|
@@ -6955,18 +6961,18 @@ var U;
|
|
|
6955
6961
|
time: d,
|
|
6956
6962
|
tags: [],
|
|
6957
6963
|
displayColor: g,
|
|
6958
|
-
channel:
|
|
6959
|
-
text:
|
|
6964
|
+
channel: m,
|
|
6965
|
+
text: l,
|
|
6960
6966
|
avatar: v,
|
|
6961
6967
|
emotes: []
|
|
6962
6968
|
},
|
|
6963
|
-
renderedText:
|
|
6969
|
+
renderedText: l
|
|
6964
6970
|
}
|
|
6965
6971
|
};
|
|
6966
6972
|
}
|
|
6967
6973
|
case "subscriber":
|
|
6968
6974
|
case "subscriber-latest": {
|
|
6969
|
-
var v = i?.avatar ?? u.random.array(
|
|
6975
|
+
var v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((S) => S.length))[0];
|
|
6970
6976
|
return {
|
|
6971
6977
|
listener: "subscriber-latest",
|
|
6972
6978
|
event: {
|
|
@@ -6984,7 +6990,7 @@ var U;
|
|
|
6984
6990
|
}
|
|
6985
6991
|
case "superchat":
|
|
6986
6992
|
case "superchat-latest": {
|
|
6987
|
-
var k = i?.amount ?? u.random.number(100, 4e3), v = i?.avatar ?? u.random.array(
|
|
6993
|
+
var k = i?.amount ?? u.random.number(100, 4e3), v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((A) => A.length))[0];
|
|
6988
6994
|
return {
|
|
6989
6995
|
listener: "superchat-latest",
|
|
6990
6996
|
event: {
|
|
@@ -7003,22 +7009,22 @@ var U;
|
|
|
7003
7009
|
}
|
|
7004
7010
|
case "sponsor":
|
|
7005
7011
|
case "sponsor-latest": {
|
|
7006
|
-
var I = i?.tier ?? u.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? u.random.number(1, 24), v = i?.avatar ?? u.random.array(
|
|
7012
|
+
var I = i?.tier ?? u.random.array(["1000", "2000", "3000"])[0], k = i?.amount ?? u.random.number(1, 24), v = i?.avatar ?? u.random.array(w.avatars)[0], c = i?.name ?? u.random.array(w.names.filter((H) => H.length))[0], j = i?.sender ?? u.random.array(w.names.filter((H) => H.length && H !== c))[0], l = i?.message ?? u.random.array(w.messages.filter((H) => H.length))[0], x = {
|
|
7007
7013
|
default: {
|
|
7008
7014
|
avatar: v,
|
|
7009
7015
|
playedAsCommunityGift: !1
|
|
7010
7016
|
},
|
|
7011
7017
|
gift: {
|
|
7012
|
-
sender:
|
|
7018
|
+
sender: j,
|
|
7013
7019
|
gifted: !0
|
|
7014
7020
|
},
|
|
7015
7021
|
community: {
|
|
7016
|
-
message:
|
|
7017
|
-
sender:
|
|
7022
|
+
message: l,
|
|
7023
|
+
sender: j,
|
|
7018
7024
|
bulkGifted: !0
|
|
7019
7025
|
},
|
|
7020
7026
|
spam: {
|
|
7021
|
-
sender:
|
|
7027
|
+
sender: j,
|
|
7022
7028
|
gifted: !0,
|
|
7023
7029
|
isCommunityGift: !0
|
|
7024
7030
|
}
|
|
@@ -7125,7 +7131,7 @@ var U;
|
|
|
7125
7131
|
facebook: {},
|
|
7126
7132
|
send(t, a) {
|
|
7127
7133
|
if (!s.queue) {
|
|
7128
|
-
|
|
7134
|
+
C.warn("Local queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: a }));
|
|
7129
7135
|
return;
|
|
7130
7136
|
}
|
|
7131
7137
|
switch (t) {
|
|
@@ -7176,18 +7182,18 @@ var U;
|
|
|
7176
7182
|
await fetch("./" + (n.fields ?? "fields.json"), {
|
|
7177
7183
|
cache: "no-store"
|
|
7178
7184
|
}).then((o) => o.json()).then(async (o) => {
|
|
7179
|
-
const c = Object.entries(o).filter(([
|
|
7180
|
-
(
|
|
7185
|
+
const c = Object.entries(o).filter(([h, { value: p }]) => p != null).reduce(
|
|
7186
|
+
(h, [p, { value: f }]) => (r && r[p] !== void 0 && (f = r[p]), h[p] = f, h),
|
|
7181
7187
|
{
|
|
7182
7188
|
...r
|
|
7183
7189
|
}
|
|
7184
|
-
),
|
|
7185
|
-
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail:
|
|
7190
|
+
), l = await s.generate.event.onWidgetLoad(c, await s.generate.session.get(i));
|
|
7191
|
+
window.dispatchEvent(new CustomEvent("onWidgetLoad", { detail: l }));
|
|
7186
7192
|
});
|
|
7187
7193
|
}
|
|
7188
7194
|
s.start = e;
|
|
7189
7195
|
})(U || (U = {}));
|
|
7190
|
-
class tt extends
|
|
7196
|
+
class tt extends N {
|
|
7191
7197
|
constructor(e) {
|
|
7192
7198
|
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, !(window.client instanceof E))
|
|
7193
7199
|
throw new Error("useQueue can only be instantiated after the Client is initialized.");
|
|
@@ -7223,7 +7229,7 @@ class tt extends R {
|
|
|
7223
7229
|
try {
|
|
7224
7230
|
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
7225
7231
|
} catch (a) {
|
|
7226
|
-
|
|
7232
|
+
C.error(`Error during item processing: ${a instanceof Error ? a.message : String(a)}`);
|
|
7227
7233
|
}
|
|
7228
7234
|
this.history.push(e);
|
|
7229
7235
|
const t = e.isPriority ? this.priorityQueue : this.queue;
|
|
@@ -7271,13 +7277,13 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7271
7277
|
}).catch(() => {
|
|
7272
7278
|
t.details.provider = "local";
|
|
7273
7279
|
}) : t.details.provider = "local", t.emit("load", e), t.loaded = !0, t.storage.on("load", (a) => {
|
|
7274
|
-
if (t.debug && a ?
|
|
7275
|
-
const i = (
|
|
7276
|
-
const
|
|
7277
|
-
for (const
|
|
7278
|
-
if (
|
|
7279
|
-
const g =
|
|
7280
|
-
g.expire && g.expire >
|
|
7280
|
+
if (t.debug && a ? C.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, a) : t.debug && C.debug("[Client]", "Storage loaded for client", `"${t.id}";`, `Provider: "${t.details.provider}";`, "No data found."), a) {
|
|
7281
|
+
const i = (l) => {
|
|
7282
|
+
const h = Date.now(), p = {};
|
|
7283
|
+
for (const f in l)
|
|
7284
|
+
if (l.hasOwnProperty(f)) {
|
|
7285
|
+
const g = l[f];
|
|
7286
|
+
g.expire && g.expire > h && (p[f] = g);
|
|
7281
7287
|
}
|
|
7282
7288
|
return p;
|
|
7283
7289
|
}, n = i(a.user || {}), r = i(a.avatar || {}), o = i(a.pronoun || {}), c = i(a.emote || {});
|
|
@@ -7299,7 +7305,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7299
7305
|
const { detail: e } = s;
|
|
7300
7306
|
if (window.client instanceof E) {
|
|
7301
7307
|
const t = window.client;
|
|
7302
|
-
t.session = e.session, t.emit("session", e.session), t.debug &&
|
|
7308
|
+
t.session = e.session, t.emit("session", e.session), t.debug && C.debug("[Client]", "Session updated", e.session);
|
|
7303
7309
|
}
|
|
7304
7310
|
}), window.addEventListener("onEventReceived", ({ detail: s }) => {
|
|
7305
7311
|
if (window.client instanceof E) {
|
|
@@ -7332,8 +7338,8 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7332
7338
|
}
|
|
7333
7339
|
case "kvstore:update": {
|
|
7334
7340
|
const n = i.event;
|
|
7335
|
-
if (
|
|
7336
|
-
var e =
|
|
7341
|
+
if (L.length) {
|
|
7342
|
+
var e = L.find((r) => r.id === n.data.key.replace("customWidget.", ""));
|
|
7337
7343
|
e && e.update(n.data.value);
|
|
7338
7344
|
}
|
|
7339
7345
|
break;
|
|
@@ -7363,7 +7369,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7363
7369
|
break;
|
|
7364
7370
|
}
|
|
7365
7371
|
case "message": {
|
|
7366
|
-
i.event,
|
|
7372
|
+
i.event, M.execute({ provider: "twitch", data: i });
|
|
7367
7373
|
break;
|
|
7368
7374
|
}
|
|
7369
7375
|
case "follower-latest": {
|
|
@@ -7390,7 +7396,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7390
7396
|
const i = t.data;
|
|
7391
7397
|
switch (i.listener) {
|
|
7392
7398
|
case "message": {
|
|
7393
|
-
i.event,
|
|
7399
|
+
i.event, M.execute({ provider: "youtube", data: i });
|
|
7394
7400
|
break;
|
|
7395
7401
|
}
|
|
7396
7402
|
case "subscriber-latest": {
|
|
@@ -7426,7 +7432,7 @@ typeof window !== void 0 && (window.addEventListener("load", () => {
|
|
|
7426
7432
|
"event:test",
|
|
7427
7433
|
"kvstore:update"
|
|
7428
7434
|
];
|
|
7429
|
-
client.debug && !a.some((i) => i === t.data.listener) &&
|
|
7435
|
+
client.debug && !a.some((i) => i === t.data.listener) && C.received("[Client]", `Event ${t.data.listener} received from ${t.provider}`, t.data.event);
|
|
7430
7436
|
}
|
|
7431
7437
|
}));
|
|
7432
7438
|
const G = {
|
|
@@ -7504,7 +7510,7 @@ var F;
|
|
|
7504
7510
|
}
|
|
7505
7511
|
s.get = a;
|
|
7506
7512
|
})(F || (F = {}));
|
|
7507
|
-
class
|
|
7513
|
+
class Ct extends N {
|
|
7508
7514
|
/**
|
|
7509
7515
|
* Initializes a new ComfyJS instance and connects to Twitch chat.
|
|
7510
7516
|
* @param options - Configuration options for ComfyJS instance.
|
|
@@ -7514,7 +7520,7 @@ class jt extends R {
|
|
|
7514
7520
|
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((a) => {
|
|
7515
7521
|
this.instance = a, this.emit("load", a), this.connect();
|
|
7516
7522
|
}).catch((a) => {
|
|
7517
|
-
|
|
7523
|
+
C.error("useComfyJs: Failed to load ComfyJS", a);
|
|
7518
7524
|
});
|
|
7519
7525
|
}
|
|
7520
7526
|
/**
|
|
@@ -7534,9 +7540,9 @@ class jt extends R {
|
|
|
7534
7540
|
*/
|
|
7535
7541
|
connect() {
|
|
7536
7542
|
this.instance.onError = (e) => {
|
|
7537
|
-
this.emit("error", e), client.debug &&
|
|
7543
|
+
this.emit("error", e), client.debug && C.error("[Client]", "ComfyJS Error:", e);
|
|
7538
7544
|
}, this.instance.onCommand = (e, t, a, i, n) => {
|
|
7539
|
-
if (this.emit("command", e, t, a, i, n), client.debug &&
|
|
7545
|
+
if (this.emit("command", e, t, a, i, n), client.debug && C.debug("[Client]", `ComfyJS Command: !${t} ${a} (User: ${e})`), this.emulate) {
|
|
7540
7546
|
const r = {
|
|
7541
7547
|
...i,
|
|
7542
7548
|
broadcaster: i.broadcaster,
|
|
@@ -7547,7 +7553,7 @@ class jt extends R {
|
|
|
7547
7553
|
}, o = {
|
|
7548
7554
|
name: e,
|
|
7549
7555
|
message: `!${t} ${a}`,
|
|
7550
|
-
badges: Object.entries(r).map(([c,
|
|
7556
|
+
badges: Object.entries(r).map(([c, l]) => l ? c : null).filter(Boolean),
|
|
7551
7557
|
color: n.userColor,
|
|
7552
7558
|
time: new Date(n.timestamp).getTime(),
|
|
7553
7559
|
userId: n.userId,
|
|
@@ -7557,7 +7563,7 @@ class jt extends R {
|
|
|
7557
7563
|
U.emulate.twitch.message(o);
|
|
7558
7564
|
}
|
|
7559
7565
|
}, this.instance.onChat = (e, t, a, i, n) => {
|
|
7560
|
-
if (this.emit("chat", e, t, a, i, n), client.debug &&
|
|
7566
|
+
if (this.emit("chat", e, t, a, i, n), client.debug && C.debug("[Client]", `ComfyJS Chat: ${t} (User: ${e})`), this.emulate) {
|
|
7561
7567
|
const r = {
|
|
7562
7568
|
...a,
|
|
7563
7569
|
...n.userBadges,
|
|
@@ -7579,22 +7585,22 @@ class jt extends R {
|
|
|
7579
7585
|
});
|
|
7580
7586
|
}
|
|
7581
7587
|
}, this.instance.onWhisper = (e, t, a, i, n) => {
|
|
7582
|
-
this.emit("whisper", e, t, a, i, n), client.debug &&
|
|
7588
|
+
this.emit("whisper", e, t, a, i, n), client.debug && C.debug("[Client]", `ComfyJS Whisper: ${t} (User: ${e})`);
|
|
7583
7589
|
}, this.instance.onMessageDeleted = (e, t) => {
|
|
7584
|
-
this.emit("messageDeleted", e, t), client.debug &&
|
|
7590
|
+
this.emit("messageDeleted", e, t), client.debug && C.debug("[Client]", `ComfyJS Message Deleted: ${e}`), this.emulate && U.emulate.twitch.deleteMessage(e);
|
|
7585
7591
|
}, this.instance.onJoin = (e, t, a) => {
|
|
7586
|
-
this.emit("join", e, t, a), client.debug &&
|
|
7592
|
+
this.emit("join", e, t, a), client.debug && C.debug("[Client]", `ComfyJS Join: ${e}`);
|
|
7587
7593
|
}, this.instance.onPart = (e, t, a) => {
|
|
7588
|
-
this.emit("part", e, t, a), client.debug &&
|
|
7594
|
+
this.emit("part", e, t, a), client.debug && C.debug("[Client]", `ComfyJS Part: ${e}`);
|
|
7589
7595
|
}, this.instance.onHosted = (e, t, a, i) => {
|
|
7590
|
-
this.emit("hosted", e, t, a, i), client.debug &&
|
|
7596
|
+
this.emit("hosted", e, t, a, i), client.debug && C.debug("[Client]", `ComfyJS Hosted: ${e} (${t} viewers)`);
|
|
7591
7597
|
}, this.instance.onRaid = (e, t, a) => {
|
|
7592
|
-
this.emit("raid", e, t, a), client.debug &&
|
|
7598
|
+
this.emit("raid", e, t, a), client.debug && C.debug("[Client]", `ComfyJS Raid: ${e} (${t} viewers)`), this.emulate && U.emulate.twitch.raid({
|
|
7593
7599
|
name: e,
|
|
7594
7600
|
amount: t
|
|
7595
7601
|
});
|
|
7596
7602
|
}, this.instance.onSub = (e, t, a, i) => {
|
|
7597
|
-
if (this.emit("sub", e, t, a, i), client.debug &&
|
|
7603
|
+
if (this.emit("sub", e, t, a, i), client.debug && C.debug("[Client]", `ComfyJS Sub: ${e} (${a.plan})`), this.emulate) {
|
|
7598
7604
|
const n = a.plan === "Prime" ? "prime" : a.plan;
|
|
7599
7605
|
U.emulate.twitch.subscriber({
|
|
7600
7606
|
name: e,
|
|
@@ -7604,7 +7610,7 @@ class jt extends R {
|
|
|
7604
7610
|
});
|
|
7605
7611
|
}
|
|
7606
7612
|
}, this.instance.onResub = (e, t, a, i, n, r) => {
|
|
7607
|
-
if (this.emit("resub", e, t, a, i, n, r), client.debug &&
|
|
7613
|
+
if (this.emit("resub", e, t, a, i, n, r), client.debug && C.debug("[Client]", `ComfyJS Resub: ${e} (${i} months)`), this.emulate) {
|
|
7608
7614
|
const o = n.plan === "Prime" ? "prime" : n.plan;
|
|
7609
7615
|
U.emulate.twitch.subscriber({
|
|
7610
7616
|
name: e,
|
|
@@ -7615,7 +7621,7 @@ class jt extends R {
|
|
|
7615
7621
|
});
|
|
7616
7622
|
}
|
|
7617
7623
|
}, this.instance.onSubGift = (e, t, a, i, n, r) => {
|
|
7618
|
-
if (this.emit("subGift", e, t, a, i, n, r), client.debug &&
|
|
7624
|
+
if (this.emit("subGift", e, t, a, i, n, r), client.debug && C.debug("[Client]", `ComfyJS Sub Gift: ${e} gifted ${i} subs`), this.emulate) {
|
|
7619
7625
|
const o = n.plan === "Prime" ? "prime" : n.plan;
|
|
7620
7626
|
U.emulate.twitch.subscriber({
|
|
7621
7627
|
name: a,
|
|
@@ -7627,7 +7633,7 @@ class jt extends R {
|
|
|
7627
7633
|
});
|
|
7628
7634
|
}
|
|
7629
7635
|
}, this.instance.onSubMysteryGift = (e, t, a, i, n) => {
|
|
7630
|
-
if (this.emit("subMysteryGift", e, t, a, i, n), client.debug &&
|
|
7636
|
+
if (this.emit("subMysteryGift", e, t, a, i, n), client.debug && C.debug("[Client]", `ComfyJS Sub Mystery Gift: ${e} gifted ${t} subs`), this.emulate) {
|
|
7631
7637
|
const r = i.plan === "Prime" ? "prime" : i.plan;
|
|
7632
7638
|
U.emulate.twitch.subscriber({
|
|
7633
7639
|
name: e,
|
|
@@ -7638,7 +7644,7 @@ class jt extends R {
|
|
|
7638
7644
|
});
|
|
7639
7645
|
}
|
|
7640
7646
|
}, this.instance.onGiftSubContinue = (e, t, a) => {
|
|
7641
|
-
this.emit("giftSubContinue", e, t, a), client.debug &&
|
|
7647
|
+
this.emit("giftSubContinue", e, t, a), client.debug && C.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${t}`), this.emulate && U.emulate.twitch.subscriber({
|
|
7642
7648
|
name: e,
|
|
7643
7649
|
message: "",
|
|
7644
7650
|
sender: t,
|
|
@@ -7646,19 +7652,19 @@ class jt extends R {
|
|
|
7646
7652
|
subType: "gift"
|
|
7647
7653
|
});
|
|
7648
7654
|
}, this.instance.onCheer = (e, t, a, i, n) => {
|
|
7649
|
-
this.emit("cheer", e, t, a, i, n), client.debug &&
|
|
7655
|
+
this.emit("cheer", e, t, a, i, n), client.debug && C.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${a} bits - ${t}`), this.emulate && U.emulate.twitch.cheer({
|
|
7650
7656
|
name: e,
|
|
7651
7657
|
message: t,
|
|
7652
7658
|
amount: a
|
|
7653
7659
|
});
|
|
7654
7660
|
}, this.instance.onChatMode = (e, t) => {
|
|
7655
|
-
this.emit("chatMode", e, t), client.debug &&
|
|
7661
|
+
this.emit("chatMode", e, t), client.debug && C.debug("[Client]", `ComfyJS Chat Mode Changed on ${t}`);
|
|
7656
7662
|
}, this.instance.onReward = (e, t, a, i, n) => {
|
|
7657
|
-
this.emit("reward", e, t, a, i, n), client.debug &&
|
|
7663
|
+
this.emit("reward", e, t, a, i, n), client.debug && C.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${t} for ${a} - ${i}`);
|
|
7658
7664
|
}, this.instance.onConnected = (e, t, a) => {
|
|
7659
|
-
this.emit("connected", e, t, a), client.debug &&
|
|
7665
|
+
this.emit("connected", e, t, a), client.debug && C.debug("[Client]", `ComfyJS Connected: ${e}:${t} (First Connect: ${a})`);
|
|
7660
7666
|
}, this.instance.onReconnect = (e) => {
|
|
7661
|
-
this.emit("reconnect", e), client.debug &&
|
|
7667
|
+
this.emit("reconnect", e), client.debug && C.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
7662
7668
|
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
7663
7669
|
}
|
|
7664
7670
|
}
|
|
@@ -7761,17 +7767,17 @@ class et {
|
|
|
7761
7767
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
7762
7768
|
}
|
|
7763
7769
|
}
|
|
7764
|
-
const it = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(kt()),
|
|
7770
|
+
const it = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(kt()), C = new et(), K = {
|
|
7765
7771
|
SeAPI: it,
|
|
7766
7772
|
Client: E,
|
|
7767
7773
|
Helper: u,
|
|
7768
7774
|
Local: U,
|
|
7769
|
-
Data:
|
|
7770
|
-
logger:
|
|
7771
|
-
modules: { EventProvider:
|
|
7772
|
-
actions: { Button: _, Command:
|
|
7773
|
-
multistream: { useComfyJs:
|
|
7774
|
-
data: { usedStorages:
|
|
7775
|
+
Data: w,
|
|
7776
|
+
logger: C,
|
|
7777
|
+
modules: { EventProvider: N, useStorage: W, useQueue: tt, useLogger: et },
|
|
7778
|
+
actions: { Button: _, Command: M },
|
|
7779
|
+
multistream: { useComfyJs: Ct },
|
|
7780
|
+
data: { usedStorages: L },
|
|
7775
7781
|
pronouns: { Alejo: F }
|
|
7776
7782
|
};
|
|
7777
7783
|
typeof window < "u" ? window.Tixyel = K : globalThis.Tixyel = K;
|