@tixyel/streamelements 4.2.2 → 4.3.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 +10 -8
- package/dist/index.es.js +622 -616
- 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
|
@@ -4998,7 +4998,7 @@ function mt(s, e = !0) {
|
|
|
4998
4998
|
let o = `#${a(s.r)}${a(s.g)}${a(s.b)}`;
|
|
4999
4999
|
return e && s.a < 1 && (o += a(s.a * 255)), o;
|
|
5000
5000
|
}
|
|
5001
|
-
function
|
|
5001
|
+
function Q(s, e, a) {
|
|
5002
5002
|
s /= 255, e /= 255, a /= 255;
|
|
5003
5003
|
const o = Math.max(s, e, a), i = Math.min(s, e, a), t = o - i;
|
|
5004
5004
|
let n = 0, c = 0;
|
|
@@ -5050,543 +5050,6 @@ function gt(s, e, a) {
|
|
|
5050
5050
|
}
|
|
5051
5051
|
return i;
|
|
5052
5052
|
}
|
|
5053
|
-
class O {
|
|
5054
|
-
/**
|
|
5055
|
-
* Stores registered event listeners.
|
|
5056
|
-
*/
|
|
5057
|
-
registeredEvents = {};
|
|
5058
|
-
/**
|
|
5059
|
-
* Emits an event to all registered listeners.
|
|
5060
|
-
* Returns an array of return values from the listeners.
|
|
5061
|
-
* @param eventName The name of the event.
|
|
5062
|
-
* @param args Arguments to pass to the listeners.
|
|
5063
|
-
*/
|
|
5064
|
-
emit(e, ...a) {
|
|
5065
|
-
return (this.registeredEvents[e] || []).map((i) => i.apply(this, a));
|
|
5066
|
-
}
|
|
5067
|
-
/**
|
|
5068
|
-
* Registers an event listener.
|
|
5069
|
-
* @param eventName The name of the event.
|
|
5070
|
-
* @param callback The callback function.
|
|
5071
|
-
*/
|
|
5072
|
-
on(e, a) {
|
|
5073
|
-
if (typeof a != "function")
|
|
5074
|
-
throw new TypeError("Callback must be a function");
|
|
5075
|
-
return this.registeredEvents[e] || (this.registeredEvents[e] = []), this.registeredEvents[e].push(a), this;
|
|
5076
|
-
}
|
|
5077
|
-
/**
|
|
5078
|
-
* Removes a specific event listener.
|
|
5079
|
-
* @param eventName The name of the event.
|
|
5080
|
-
* @param callback The callback function to remove.
|
|
5081
|
-
*/
|
|
5082
|
-
off(e, a) {
|
|
5083
|
-
const o = this.registeredEvents[e] || [];
|
|
5084
|
-
return a ? (this.registeredEvents[e] = o.filter((i) => i !== a), this) : (this.registeredEvents[e] = [], this);
|
|
5085
|
-
}
|
|
5086
|
-
/**
|
|
5087
|
-
* Registers a listener that is executed only once.
|
|
5088
|
-
* @param eventName The name of the event.
|
|
5089
|
-
* @param callback The callback function.
|
|
5090
|
-
*/
|
|
5091
|
-
once(e, a) {
|
|
5092
|
-
const o = (...i) => {
|
|
5093
|
-
this.off(e, o), a.apply(this, i);
|
|
5094
|
-
};
|
|
5095
|
-
return this.on(e, o), this;
|
|
5096
|
-
}
|
|
5097
|
-
/**
|
|
5098
|
-
* Removes all listeners for a specific event.
|
|
5099
|
-
* @param eventName The name of the event.
|
|
5100
|
-
*/
|
|
5101
|
-
removeAllListeners(e) {
|
|
5102
|
-
return this.registeredEvents[e] = [], this;
|
|
5103
|
-
}
|
|
5104
|
-
}
|
|
5105
|
-
var _ = [];
|
|
5106
|
-
class S extends O {
|
|
5107
|
-
/**
|
|
5108
|
-
* The unique identifier for the storage instance.
|
|
5109
|
-
*/
|
|
5110
|
-
id = "default";
|
|
5111
|
-
loaded = !1;
|
|
5112
|
-
data;
|
|
5113
|
-
constructor(e) {
|
|
5114
|
-
super(), this.id = e.id || this.id, this.data = e.data ?? {}, _.push(this), this.start();
|
|
5115
|
-
}
|
|
5116
|
-
SE_API = null;
|
|
5117
|
-
start() {
|
|
5118
|
-
tt?.then((e) => {
|
|
5119
|
-
this.SE_API = e, e.store.get(this.id).then((a) => {
|
|
5120
|
-
this.data = a ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(a) && this.emit("update", this.data);
|
|
5121
|
-
}).catch(() => {
|
|
5122
|
-
this.loaded = !0, this.emit("load", this.data);
|
|
5123
|
-
});
|
|
5124
|
-
});
|
|
5125
|
-
}
|
|
5126
|
-
/**
|
|
5127
|
-
* Saves the current data to storage.
|
|
5128
|
-
* @param data Data to save (defaults to current)
|
|
5129
|
-
*/
|
|
5130
|
-
save(e = this.data) {
|
|
5131
|
-
this.loaded && this.SE_API && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
|
|
5132
|
-
}
|
|
5133
|
-
/**
|
|
5134
|
-
* Updates the storage data and emits an update event
|
|
5135
|
-
* @param data Data to update (defaults to current)
|
|
5136
|
-
*/
|
|
5137
|
-
update(e = this.data) {
|
|
5138
|
-
this.loaded && JSON.stringify(this.data) !== JSON.stringify(e) && (this.data = { ...this.data, ...e }, this.save(this.data));
|
|
5139
|
-
}
|
|
5140
|
-
/**
|
|
5141
|
-
* Adds a value to the storage at the specified path.
|
|
5142
|
-
* @param path Path to add the value to
|
|
5143
|
-
* @param value Value to add
|
|
5144
|
-
*/
|
|
5145
|
-
add(e, a) {
|
|
5146
|
-
this.loaded && (S.setByPath(this.data, e, a), this.save(this.data));
|
|
5147
|
-
}
|
|
5148
|
-
/**
|
|
5149
|
-
* Clears all data from the storage.
|
|
5150
|
-
*/
|
|
5151
|
-
clear() {
|
|
5152
|
-
this.loaded && (this.data = {}, this.save(this.data));
|
|
5153
|
-
}
|
|
5154
|
-
/**
|
|
5155
|
-
* Sets a value in the storage at the specified path.
|
|
5156
|
-
* @param obj The object to set the value in
|
|
5157
|
-
* @param path The path to set the value at
|
|
5158
|
-
* @param value The value to set
|
|
5159
|
-
* @returns The updated object
|
|
5160
|
-
*/
|
|
5161
|
-
static setByPath(e, a, o) {
|
|
5162
|
-
const i = a.split(".");
|
|
5163
|
-
let t = e;
|
|
5164
|
-
for (let n = 0; n < i.length - 1; n++)
|
|
5165
|
-
(typeof t[i[n]] != "object" || t[i[n]] == null) && (t[i[n]] = {}), t = t[i[n]];
|
|
5166
|
-
return t[i[i.length - 1]] = o, t;
|
|
5167
|
-
}
|
|
5168
|
-
on(e, a) {
|
|
5169
|
-
return e === "load" && this.loaded ? (a.apply(this, [this.data]), this) : (super.on(e, a), this);
|
|
5170
|
-
}
|
|
5171
|
-
}
|
|
5172
|
-
class J extends O {
|
|
5173
|
-
id = "default";
|
|
5174
|
-
debug = !1;
|
|
5175
|
-
storage;
|
|
5176
|
-
fields = {};
|
|
5177
|
-
session;
|
|
5178
|
-
loaded = !1;
|
|
5179
|
-
constructor(e) {
|
|
5180
|
-
super(), this.id = e.id || this.id, this.storage = new S({
|
|
5181
|
-
id: this.id,
|
|
5182
|
-
data: {
|
|
5183
|
-
user: {},
|
|
5184
|
-
avatar: {},
|
|
5185
|
-
pronoun: {},
|
|
5186
|
-
emote: {}
|
|
5187
|
-
}
|
|
5188
|
-
}), this.on("load", () => {
|
|
5189
|
-
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
5190
|
-
}), window.client = this;
|
|
5191
|
-
}
|
|
5192
|
-
actions = {
|
|
5193
|
-
commands: [],
|
|
5194
|
-
buttons: []
|
|
5195
|
-
};
|
|
5196
|
-
details;
|
|
5197
|
-
cache = {
|
|
5198
|
-
avatar: 30,
|
|
5199
|
-
pronoun: 60,
|
|
5200
|
-
emote: 120
|
|
5201
|
-
};
|
|
5202
|
-
on(e, a) {
|
|
5203
|
-
return e === "load" && this.loaded ? (a.apply(this, [
|
|
5204
|
-
{
|
|
5205
|
-
channel: this.details.user,
|
|
5206
|
-
currency: this.details.currency,
|
|
5207
|
-
fieldData: this.fields,
|
|
5208
|
-
recents: [],
|
|
5209
|
-
session: {
|
|
5210
|
-
data: this.session,
|
|
5211
|
-
settings: {
|
|
5212
|
-
autoReset: !1,
|
|
5213
|
-
calendar: !1,
|
|
5214
|
-
resetOnStart: !1
|
|
5215
|
-
}
|
|
5216
|
-
},
|
|
5217
|
-
overlay: this.details.overlay,
|
|
5218
|
-
emulated: !1
|
|
5219
|
-
}
|
|
5220
|
-
]), this) : (super.on(e, a), this);
|
|
5221
|
-
}
|
|
5222
|
-
}
|
|
5223
|
-
class Q extends O {
|
|
5224
|
-
queue = [];
|
|
5225
|
-
priorityQueue = [];
|
|
5226
|
-
history = [];
|
|
5227
|
-
timeouts = [];
|
|
5228
|
-
running = !1;
|
|
5229
|
-
duration = void 0;
|
|
5230
|
-
loaded = !1;
|
|
5231
|
-
processor;
|
|
5232
|
-
constructor(e) {
|
|
5233
|
-
if (super(), !(window.client instanceof J))
|
|
5234
|
-
throw new Error("useQueue can only be instantiated after the Client is initialized.");
|
|
5235
|
-
if (!e.processor || typeof e.processor != "function")
|
|
5236
|
-
throw new Error("A valid processor function must be provided to useQueue.");
|
|
5237
|
-
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), window.client.on("load", () => {
|
|
5238
|
-
e.duration === "client" && (this.duration = window.client.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0;
|
|
5239
|
-
});
|
|
5240
|
-
}
|
|
5241
|
-
enqueue(e, a = {}) {
|
|
5242
|
-
const o = {
|
|
5243
|
-
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5244
|
-
isLoop: a?.isLoop ?? !1,
|
|
5245
|
-
isPriority: a?.isPriority ?? !1,
|
|
5246
|
-
isImmediate: a?.isImmediate ?? !1,
|
|
5247
|
-
value: e
|
|
5248
|
-
}, i = this.hasItems();
|
|
5249
|
-
return o.isPriority && o.isImmediate ? (this.cancel(), this.priorityQueue.unshift(o)) : (o.isPriority ? this.priorityQueue : this.queue).push(o), this.running === !1 && i === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
5250
|
-
}
|
|
5251
|
-
async run() {
|
|
5252
|
-
if (!this.hasItems()) {
|
|
5253
|
-
this.running = !1;
|
|
5254
|
-
return;
|
|
5255
|
-
}
|
|
5256
|
-
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();
|
|
5257
|
-
}
|
|
5258
|
-
async next() {
|
|
5259
|
-
const e = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
|
|
5260
|
-
if (!e) {
|
|
5261
|
-
this.running = !1;
|
|
5262
|
-
return;
|
|
5263
|
-
}
|
|
5264
|
-
try {
|
|
5265
|
-
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
5266
|
-
} catch (o) {
|
|
5267
|
-
k.error(`Error during item processing: ${o instanceof Error ? o.message : String(o)}`);
|
|
5268
|
-
}
|
|
5269
|
-
this.history.push(e);
|
|
5270
|
-
const a = e.isPriority ? this.priorityQueue : this.queue;
|
|
5271
|
-
e.isLoop && a.push(e);
|
|
5272
|
-
}
|
|
5273
|
-
resume() {
|
|
5274
|
-
return this.running && this.cancel(), this.hasItems() && this.run(), this;
|
|
5275
|
-
}
|
|
5276
|
-
update(e) {
|
|
5277
|
-
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;
|
|
5278
|
-
}
|
|
5279
|
-
cancel() {
|
|
5280
|
-
this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
|
|
5281
|
-
}
|
|
5282
|
-
hasItems() {
|
|
5283
|
-
return this.queue.length > 0 || this.priorityQueue.length > 0;
|
|
5284
|
-
}
|
|
5285
|
-
on(e, a) {
|
|
5286
|
-
return e === "load" && this.loaded ? (a.apply(this), this) : (super.on(e, a), this);
|
|
5287
|
-
}
|
|
5288
|
-
}
|
|
5289
|
-
class R {
|
|
5290
|
-
prefix = "!";
|
|
5291
|
-
name;
|
|
5292
|
-
description;
|
|
5293
|
-
arguments = !1;
|
|
5294
|
-
test = `${this.prefix}${this.name} arg1 arg2`;
|
|
5295
|
-
aliases = [];
|
|
5296
|
-
permissions = void 0;
|
|
5297
|
-
admins = [];
|
|
5298
|
-
constructor(e) {
|
|
5299
|
-
window.client instanceof J && (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"));
|
|
5300
|
-
}
|
|
5301
|
-
run(e, a) {
|
|
5302
|
-
}
|
|
5303
|
-
verify(e, a, o) {
|
|
5304
|
-
return this.arguments === !0 && (!o || !o.length) ? !1 : this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) ? !0 : this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length ? !1 : !!(Array.isArray(this.permissions) && this.permissions.some((i) => e.toLowerCase() === i.toLowerCase() || a.map((t) => t.toLowerCase()).includes(i.toLowerCase())));
|
|
5305
|
-
}
|
|
5306
|
-
parse(e, a) {
|
|
5307
|
-
if (!(window.client instanceof J)) return !1;
|
|
5308
|
-
const o = e.replace(this.prefix, "").split(" ").slice(1).map((r) => r.trim());
|
|
5309
|
-
var i = "", t = [];
|
|
5310
|
-
const n = { bits: "cheer", premium: "prime" };
|
|
5311
|
-
switch (a.provider) {
|
|
5312
|
-
case "twitch": {
|
|
5313
|
-
const r = a.data;
|
|
5314
|
-
i = r.event.data.nick || r.event.data.displayName, r.event.data.tags?.badges && (t = r.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((l) => l in n ? n[l] : l));
|
|
5315
|
-
break;
|
|
5316
|
-
}
|
|
5317
|
-
case "youtube": {
|
|
5318
|
-
const r = a.data, d = {
|
|
5319
|
-
isVerified: "verified",
|
|
5320
|
-
isChatOwner: "owner",
|
|
5321
|
-
isChatSponsor: "sponsor",
|
|
5322
|
-
isChatModerator: "moderator"
|
|
5323
|
-
};
|
|
5324
|
-
i = r.event.data.nick || r.event.data.displayName, t = Object.entries(r.event.data.authorDetails).filter(([l, m]) => l.startsWith("is") && m).map(([l]) => d[l]).filter(Boolean);
|
|
5325
|
-
break;
|
|
5326
|
-
}
|
|
5327
|
-
case "kick":
|
|
5328
|
-
return !1;
|
|
5329
|
-
}
|
|
5330
|
-
const c = this.verify(i, t, o);
|
|
5331
|
-
return c === !0 && this.run.apply(window.client, [o, a]), c;
|
|
5332
|
-
}
|
|
5333
|
-
remove() {
|
|
5334
|
-
if (!(window.client instanceof J)) return;
|
|
5335
|
-
const e = window.client.actions.commands.indexOf(this);
|
|
5336
|
-
e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
5337
|
-
}
|
|
5338
|
-
static execute(e) {
|
|
5339
|
-
if (!(window.client instanceof J)) return !1;
|
|
5340
|
-
const a = e.data;
|
|
5341
|
-
try {
|
|
5342
|
-
if (window.client.actions.commands.length && window.client.actions.commands.some((o) => a.event.data.text.startsWith(o.prefix))) {
|
|
5343
|
-
const o = window.client.actions.commands.filter((i) => {
|
|
5344
|
-
var t = [i.name, ...i.aliases ?? []], n = a.event.data.text.replace(i.prefix, "").split(" ")[0];
|
|
5345
|
-
return t.includes(n);
|
|
5346
|
-
});
|
|
5347
|
-
if (o.length && o.every((i) => i instanceof R))
|
|
5348
|
-
return o.forEach((i) => {
|
|
5349
|
-
i.parse(a.event.data.text, e), window.client.emit("action", i, "executed"), k.received(`Command executed: ${a.event.data.text} by ${a.event.data.nick || a.event.data.displayName}`, a);
|
|
5350
|
-
}), !0;
|
|
5351
|
-
}
|
|
5352
|
-
} catch {
|
|
5353
|
-
return !1;
|
|
5354
|
-
} finally {
|
|
5355
|
-
return !1;
|
|
5356
|
-
}
|
|
5357
|
-
}
|
|
5358
|
-
}
|
|
5359
|
-
class V {
|
|
5360
|
-
field = "button";
|
|
5361
|
-
template = "button";
|
|
5362
|
-
run;
|
|
5363
|
-
constructor(e) {
|
|
5364
|
-
window.client instanceof J && (this.field = e.field ?? this.field, this.template = e.template ?? this.template, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
|
|
5365
|
-
}
|
|
5366
|
-
parse(e, a) {
|
|
5367
|
-
var o = e.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
|
|
5368
|
-
try {
|
|
5369
|
-
this.run.apply(window.client, [o.length ? o : e ?? e, a]);
|
|
5370
|
-
} catch (i) {
|
|
5371
|
-
throw new Error(`Error running button "${this.field}": ${i instanceof Error ? i.message : i}`);
|
|
5372
|
-
}
|
|
5373
|
-
return this;
|
|
5374
|
-
}
|
|
5375
|
-
remove() {
|
|
5376
|
-
if (!(window.client instanceof J)) return;
|
|
5377
|
-
const e = window.client.actions.buttons.indexOf(this);
|
|
5378
|
-
e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
5379
|
-
}
|
|
5380
|
-
static execute(e, a) {
|
|
5381
|
-
try {
|
|
5382
|
-
if (!(window.client instanceof J)) return !1;
|
|
5383
|
-
if (window.client.actions.buttons.length) {
|
|
5384
|
-
const o = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, a) : !1);
|
|
5385
|
-
if (o.length && o.every((i) => i instanceof V))
|
|
5386
|
-
return o.forEach((i) => {
|
|
5387
|
-
try {
|
|
5388
|
-
i.parse(e, a), window.client.emit("action", i, "executed"), k.received(`Button executed: ${e}${a ? ` with value: ${a}` : ""}`);
|
|
5389
|
-
} catch (t) {
|
|
5390
|
-
k.error(`Error executing button "${e}": ${t instanceof Error ? t.message : t}`);
|
|
5391
|
-
}
|
|
5392
|
-
}), !0;
|
|
5393
|
-
}
|
|
5394
|
-
} catch {
|
|
5395
|
-
return !1;
|
|
5396
|
-
} finally {
|
|
5397
|
-
return !1;
|
|
5398
|
-
}
|
|
5399
|
-
}
|
|
5400
|
-
}
|
|
5401
|
-
window.addEventListener("load", () => {
|
|
5402
|
-
});
|
|
5403
|
-
window.addEventListener("onWidgetLoad", async (s) => {
|
|
5404
|
-
const { detail: e } = s;
|
|
5405
|
-
if (window.client instanceof J) {
|
|
5406
|
-
const a = window.client;
|
|
5407
|
-
a.fields = e.fieldData, a.session = e.session.data, a.details = {
|
|
5408
|
-
...a.details,
|
|
5409
|
-
user: e.channel,
|
|
5410
|
-
currency: e.currency,
|
|
5411
|
-
overlay: e.overlay
|
|
5412
|
-
}, e.channel.id && !e.emulated ? await fetch(`https://api.streamelements.com/kappa/v2/channels/${e.channel.id}/`).then((o) => o.json()).then((o) => {
|
|
5413
|
-
if (o.provider)
|
|
5414
|
-
return a.details.provider = o.provider, o.provider;
|
|
5415
|
-
a.details.provider = "local";
|
|
5416
|
-
}).catch(() => {
|
|
5417
|
-
a.details.provider = "local";
|
|
5418
|
-
}) : a.details.provider = "local", a.emit("load", e), a.loaded = !0, a.storage.on("load", (o) => {
|
|
5419
|
-
if (a.debug && o ? k.debug("[Client]", "Storage loaded for client", `"${a.id}";`, `Provider: "${a.details.provider}";`, o) : a.debug && k.debug("[Client]", "Storage loaded for client", `"${a.id}";`, `Provider: "${a.details.provider}";`, "No data found."), o) {
|
|
5420
|
-
const i = (d) => {
|
|
5421
|
-
const l = Date.now(), m = {};
|
|
5422
|
-
for (const u in d)
|
|
5423
|
-
if (d.hasOwnProperty(u)) {
|
|
5424
|
-
const f = d[u];
|
|
5425
|
-
f.expire && f.expire > l && (m[u] = f);
|
|
5426
|
-
}
|
|
5427
|
-
return m;
|
|
5428
|
-
}, t = i(o.user || {}), n = i(o.avatar || {}), c = i(o.pronoun || {}), r = i(o.emote || {});
|
|
5429
|
-
a.storage.update({
|
|
5430
|
-
user: t,
|
|
5431
|
-
avatar: n,
|
|
5432
|
-
pronoun: c,
|
|
5433
|
-
emote: r
|
|
5434
|
-
});
|
|
5435
|
-
}
|
|
5436
|
-
e.channel.providerId.length && a.storage.add(`avatar.${e.channel.providerId.toLowerCase()}`, {
|
|
5437
|
-
value: e.channel.avatar,
|
|
5438
|
-
timestamp: Date.now(),
|
|
5439
|
-
expire: Date.now() + a.cache.avatar * 60 * 1e3
|
|
5440
|
-
});
|
|
5441
|
-
});
|
|
5442
|
-
}
|
|
5443
|
-
});
|
|
5444
|
-
window.addEventListener("onSessionUpdate", (s) => {
|
|
5445
|
-
const { detail: e } = s;
|
|
5446
|
-
if (window.client instanceof J) {
|
|
5447
|
-
const a = window.client;
|
|
5448
|
-
a.session = e.session, a.emit("session", e.session), a.debug && k.debug("[Client]", "Session updated", e.session);
|
|
5449
|
-
}
|
|
5450
|
-
});
|
|
5451
|
-
function Z(s) {
|
|
5452
|
-
var e = s.event?.provider || s.event?.service || s.event?.data?.provider || window.client.details.provider;
|
|
5453
|
-
return [
|
|
5454
|
-
"kvstore:update",
|
|
5455
|
-
"bot:counter",
|
|
5456
|
-
"alertService:toggleSound",
|
|
5457
|
-
"tip-latest",
|
|
5458
|
-
"event:test",
|
|
5459
|
-
"event:skip"
|
|
5460
|
-
].some((i) => i === s.listener) && (e = "streamelements"), { provider: e, data: s };
|
|
5461
|
-
}
|
|
5462
|
-
window.addEventListener("onEventReceived", ({ detail: s }) => {
|
|
5463
|
-
if (window.client instanceof J) {
|
|
5464
|
-
const a = Z(s);
|
|
5465
|
-
switch (a.provider) {
|
|
5466
|
-
case "streamelements": {
|
|
5467
|
-
const i = a.data;
|
|
5468
|
-
switch (i.listener) {
|
|
5469
|
-
case "tip-latest": {
|
|
5470
|
-
i.event;
|
|
5471
|
-
break;
|
|
5472
|
-
}
|
|
5473
|
-
case "event:skip": {
|
|
5474
|
-
i.event;
|
|
5475
|
-
break;
|
|
5476
|
-
}
|
|
5477
|
-
case "event:test": {
|
|
5478
|
-
switch (i.event.listener) {
|
|
5479
|
-
case "widget-button": {
|
|
5480
|
-
const t = i.event;
|
|
5481
|
-
V.execute(t.field, t.value);
|
|
5482
|
-
break;
|
|
5483
|
-
}
|
|
5484
|
-
case "subscriber-latest": {
|
|
5485
|
-
i.event;
|
|
5486
|
-
break;
|
|
5487
|
-
}
|
|
5488
|
-
}
|
|
5489
|
-
break;
|
|
5490
|
-
}
|
|
5491
|
-
case "kvstore:update": {
|
|
5492
|
-
const t = i.event;
|
|
5493
|
-
if (_.length) {
|
|
5494
|
-
var e = _.find((n) => n.id === t.data.key.replace("customWidget.", ""));
|
|
5495
|
-
e && e.update(t.data.value);
|
|
5496
|
-
}
|
|
5497
|
-
break;
|
|
5498
|
-
}
|
|
5499
|
-
case "bot:counter": {
|
|
5500
|
-
i.event;
|
|
5501
|
-
break;
|
|
5502
|
-
}
|
|
5503
|
-
case "alertService:toggleSound": {
|
|
5504
|
-
const t = i.event;
|
|
5505
|
-
client.details.overlay.muted = !!t.muted;
|
|
5506
|
-
break;
|
|
5507
|
-
}
|
|
5508
|
-
}
|
|
5509
|
-
window.client.emit("event", "streamelements", a.data);
|
|
5510
|
-
break;
|
|
5511
|
-
}
|
|
5512
|
-
case "twitch": {
|
|
5513
|
-
const i = a.data;
|
|
5514
|
-
switch (i.listener) {
|
|
5515
|
-
case "delete-message": {
|
|
5516
|
-
i.event;
|
|
5517
|
-
break;
|
|
5518
|
-
}
|
|
5519
|
-
case "delete-messages": {
|
|
5520
|
-
i.event;
|
|
5521
|
-
break;
|
|
5522
|
-
}
|
|
5523
|
-
case "message": {
|
|
5524
|
-
i.event, R.execute({ provider: "twitch", data: i });
|
|
5525
|
-
break;
|
|
5526
|
-
}
|
|
5527
|
-
case "follower-latest": {
|
|
5528
|
-
i.event;
|
|
5529
|
-
break;
|
|
5530
|
-
}
|
|
5531
|
-
case "cheer-latest": {
|
|
5532
|
-
i.event;
|
|
5533
|
-
break;
|
|
5534
|
-
}
|
|
5535
|
-
case "subscriber-latest": {
|
|
5536
|
-
(!i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && i.event.isCommunityGift || !i.event.gifted && i.event.bulkGifted && !i.event.isCommunityGift) && i.event;
|
|
5537
|
-
break;
|
|
5538
|
-
}
|
|
5539
|
-
case "raid-latest": {
|
|
5540
|
-
i.event;
|
|
5541
|
-
break;
|
|
5542
|
-
}
|
|
5543
|
-
}
|
|
5544
|
-
window.client.emit("event", "twitch", a.data);
|
|
5545
|
-
break;
|
|
5546
|
-
}
|
|
5547
|
-
case "youtube": {
|
|
5548
|
-
const i = a.data;
|
|
5549
|
-
switch (i.listener) {
|
|
5550
|
-
case "message": {
|
|
5551
|
-
i.event, R.execute({ provider: "youtube", data: i });
|
|
5552
|
-
break;
|
|
5553
|
-
}
|
|
5554
|
-
case "subscriber-latest": {
|
|
5555
|
-
i.event;
|
|
5556
|
-
break;
|
|
5557
|
-
}
|
|
5558
|
-
case "sponsor-latest": {
|
|
5559
|
-
i.event, (!i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && i.event.isCommunityGift || !i.event.gifted && i.event.bulkGifted && !i.event.isCommunityGift) && i.event;
|
|
5560
|
-
break;
|
|
5561
|
-
}
|
|
5562
|
-
case "superchat-latest": {
|
|
5563
|
-
i.event;
|
|
5564
|
-
break;
|
|
5565
|
-
}
|
|
5566
|
-
}
|
|
5567
|
-
window.client.emit("event", "youtube", a.data);
|
|
5568
|
-
break;
|
|
5569
|
-
}
|
|
5570
|
-
case "kick": {
|
|
5571
|
-
a.data, window.client.emit("event", "kick", a.data);
|
|
5572
|
-
break;
|
|
5573
|
-
}
|
|
5574
|
-
case "facebook": {
|
|
5575
|
-
a.data, window.client.emit("event", "facebook", a.data);
|
|
5576
|
-
break;
|
|
5577
|
-
}
|
|
5578
|
-
}
|
|
5579
|
-
const o = [
|
|
5580
|
-
"bot:counter",
|
|
5581
|
-
"alertService:toggleSound",
|
|
5582
|
-
"event",
|
|
5583
|
-
"event:skip",
|
|
5584
|
-
"event:test",
|
|
5585
|
-
"kvstore:update"
|
|
5586
|
-
];
|
|
5587
|
-
client.debug && !o.some((i) => i === a.data.listener) && k.received("[Client]", `Event ${a.data.listener} received from ${a.provider}`, a.data.event);
|
|
5588
|
-
}
|
|
5589
|
-
});
|
|
5590
5053
|
var x;
|
|
5591
5054
|
((s) => {
|
|
5592
5055
|
s.data = {
|
|
@@ -5665,11 +5128,11 @@ var x;
|
|
|
5665
5128
|
case "rgba":
|
|
5666
5129
|
return `rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`;
|
|
5667
5130
|
case "hsl": {
|
|
5668
|
-
const d =
|
|
5131
|
+
const d = Q(r.r, r.g, r.b);
|
|
5669
5132
|
return `hsl(${d.h}, ${d.s}%, ${d.l}%)`;
|
|
5670
5133
|
}
|
|
5671
5134
|
case "hsla": {
|
|
5672
|
-
const d =
|
|
5135
|
+
const d = Q(r.r, r.g, r.b);
|
|
5673
5136
|
return `hsla(${d.h}, ${d.s}%, ${d.l}%, ${r.a})`;
|
|
5674
5137
|
}
|
|
5675
5138
|
case "css-color-name":
|
|
@@ -5994,9 +5457,9 @@ var x;
|
|
|
5994
5457
|
let I = null;
|
|
5995
5458
|
if (h[g] === ":") {
|
|
5996
5459
|
g++;
|
|
5997
|
-
const
|
|
5460
|
+
const V = g;
|
|
5998
5461
|
for (; g < b && h[g] !== "="; ) g++;
|
|
5999
|
-
I = h.slice(
|
|
5462
|
+
I = h.slice(V, g);
|
|
6000
5463
|
}
|
|
6001
5464
|
h[g] === "=" && g++;
|
|
6002
5465
|
const T = U("]");
|
|
@@ -6922,11 +6385,11 @@ var x;
|
|
|
6922
6385
|
case "mute":
|
|
6923
6386
|
case "unmute":
|
|
6924
6387
|
case "alertService:toggleSound": {
|
|
6925
|
-
var
|
|
6388
|
+
var V = c?.muted ?? !client.details.overlay.muted;
|
|
6926
6389
|
return {
|
|
6927
6390
|
listener: "alertService:toggleSound",
|
|
6928
6391
|
event: {
|
|
6929
|
-
muted:
|
|
6392
|
+
muted: V,
|
|
6930
6393
|
provider: t
|
|
6931
6394
|
}
|
|
6932
6395
|
};
|
|
@@ -7075,15 +6538,7 @@ var x;
|
|
|
7075
6538
|
}
|
|
7076
6539
|
}
|
|
7077
6540
|
}
|
|
7078
|
-
}, s.
|
|
7079
|
-
duration: "client",
|
|
7080
|
-
processor: async function(n) {
|
|
7081
|
-
if (window.dispatchEvent(new CustomEvent(n.listener, { detail: n.data })), n.listener === "onEventReceived" && n.session) {
|
|
7082
|
-
const c = await s.generate.event.onSessionUpdate(client.session, Z(n.data));
|
|
7083
|
-
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: c }));
|
|
7084
|
-
}
|
|
7085
|
-
}
|
|
7086
|
-
}), s.emulate = {
|
|
6541
|
+
}, s.emulate = {
|
|
7087
6542
|
twitch: {
|
|
7088
6543
|
message(t = {}) {
|
|
7089
6544
|
s.generate.event.onEventReceived("twitch", "message", t).then((n) => {
|
|
@@ -7163,6 +6618,10 @@ var x;
|
|
|
7163
6618
|
kick: {},
|
|
7164
6619
|
facebook: {},
|
|
7165
6620
|
send(t, n) {
|
|
6621
|
+
if (!s.queue) {
|
|
6622
|
+
k.warn("Simulation queue is not initialized."), window.dispatchEvent(new CustomEvent(t, { detail: n }));
|
|
6623
|
+
return;
|
|
6624
|
+
}
|
|
7166
6625
|
switch (t) {
|
|
7167
6626
|
case "onEventReceived": {
|
|
7168
6627
|
s.queue.enqueue({
|
|
@@ -7307,44 +6766,163 @@ async function K(s = [], e = "twitch") {
|
|
|
7307
6766
|
break;
|
|
7308
6767
|
}
|
|
7309
6768
|
}
|
|
7310
|
-
return i;
|
|
7311
|
-
}
|
|
7312
|
-
const Y = {
|
|
7313
|
-
getOverlayStatus: () => ({
|
|
7314
|
-
isEditorMode: !1,
|
|
7315
|
-
muted: !1
|
|
7316
|
-
}),
|
|
7317
|
-
resumeQueue: () => {
|
|
7318
|
-
},
|
|
7319
|
-
responses: {},
|
|
7320
|
-
sendMessage(s, e) {
|
|
7321
|
-
},
|
|
7322
|
-
counters: {
|
|
7323
|
-
get(s) {
|
|
7324
|
-
return null;
|
|
7325
|
-
}
|
|
7326
|
-
},
|
|
7327
|
-
sanitize(s) {
|
|
7328
|
-
return s;
|
|
7329
|
-
},
|
|
7330
|
-
cheerFilter(s) {
|
|
7331
|
-
return s;
|
|
7332
|
-
},
|
|
7333
|
-
setField(s, e, a) {
|
|
7334
|
-
},
|
|
7335
|
-
store: {
|
|
7336
|
-
set: function(s, e) {
|
|
7337
|
-
this.list[s] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(Y.store.list));
|
|
7338
|
-
},
|
|
7339
|
-
get: async function(s) {
|
|
7340
|
-
return this.list[s] ? this.list[s] : null;
|
|
7341
|
-
},
|
|
7342
|
-
list: {}
|
|
6769
|
+
return i;
|
|
6770
|
+
}
|
|
6771
|
+
const Y = {
|
|
6772
|
+
getOverlayStatus: () => ({
|
|
6773
|
+
isEditorMode: !1,
|
|
6774
|
+
muted: !1
|
|
6775
|
+
}),
|
|
6776
|
+
resumeQueue: () => {
|
|
6777
|
+
},
|
|
6778
|
+
responses: {},
|
|
6779
|
+
sendMessage(s, e) {
|
|
6780
|
+
},
|
|
6781
|
+
counters: {
|
|
6782
|
+
get(s) {
|
|
6783
|
+
return null;
|
|
6784
|
+
}
|
|
6785
|
+
},
|
|
6786
|
+
sanitize(s) {
|
|
6787
|
+
return s;
|
|
6788
|
+
},
|
|
6789
|
+
cheerFilter(s) {
|
|
6790
|
+
return s;
|
|
6791
|
+
},
|
|
6792
|
+
setField(s, e, a) {
|
|
6793
|
+
},
|
|
6794
|
+
store: {
|
|
6795
|
+
set: function(s, e) {
|
|
6796
|
+
this.list[s] = e, localStorage.setItem("SE_API-STORE", JSON.stringify(Y.store.list));
|
|
6797
|
+
},
|
|
6798
|
+
get: async function(s) {
|
|
6799
|
+
return this.list[s] ? this.list[s] : null;
|
|
6800
|
+
},
|
|
6801
|
+
list: {}
|
|
6802
|
+
}
|
|
6803
|
+
};
|
|
6804
|
+
async function ft() {
|
|
6805
|
+
let s = localStorage.getItem("SE_API-STORE") ?? "", e = s ? JSON.parse(s) : {};
|
|
6806
|
+
return Y.store.list = e, Y;
|
|
6807
|
+
}
|
|
6808
|
+
class O {
|
|
6809
|
+
/**
|
|
6810
|
+
* Stores registered event listeners.
|
|
6811
|
+
*/
|
|
6812
|
+
registeredEvents = {};
|
|
6813
|
+
/**
|
|
6814
|
+
* Emits an event to all registered listeners.
|
|
6815
|
+
* Returns an array of return values from the listeners.
|
|
6816
|
+
* @param eventName The name of the event.
|
|
6817
|
+
* @param args Arguments to pass to the listeners.
|
|
6818
|
+
*/
|
|
6819
|
+
emit(e, ...a) {
|
|
6820
|
+
return (this.registeredEvents[e] || []).map((i) => i.apply(this, a));
|
|
6821
|
+
}
|
|
6822
|
+
/**
|
|
6823
|
+
* Registers an event listener.
|
|
6824
|
+
* @param eventName The name of the event.
|
|
6825
|
+
* @param callback The callback function.
|
|
6826
|
+
*/
|
|
6827
|
+
on(e, a) {
|
|
6828
|
+
if (typeof a != "function")
|
|
6829
|
+
throw new TypeError("Callback must be a function");
|
|
6830
|
+
return this.registeredEvents[e] || (this.registeredEvents[e] = []), this.registeredEvents[e].push(a), this;
|
|
6831
|
+
}
|
|
6832
|
+
/**
|
|
6833
|
+
* Removes a specific event listener.
|
|
6834
|
+
* @param eventName The name of the event.
|
|
6835
|
+
* @param callback The callback function to remove.
|
|
6836
|
+
*/
|
|
6837
|
+
off(e, a) {
|
|
6838
|
+
const o = this.registeredEvents[e] || [];
|
|
6839
|
+
return a ? (this.registeredEvents[e] = o.filter((i) => i !== a), this) : (this.registeredEvents[e] = [], this);
|
|
6840
|
+
}
|
|
6841
|
+
/**
|
|
6842
|
+
* Registers a listener that is executed only once.
|
|
6843
|
+
* @param eventName The name of the event.
|
|
6844
|
+
* @param callback The callback function.
|
|
6845
|
+
*/
|
|
6846
|
+
once(e, a) {
|
|
6847
|
+
const o = (...i) => {
|
|
6848
|
+
this.off(e, o), a.apply(this, i);
|
|
6849
|
+
};
|
|
6850
|
+
return this.on(e, o), this;
|
|
6851
|
+
}
|
|
6852
|
+
/**
|
|
6853
|
+
* Removes all listeners for a specific event.
|
|
6854
|
+
* @param eventName The name of the event.
|
|
6855
|
+
*/
|
|
6856
|
+
removeAllListeners(e) {
|
|
6857
|
+
return this.registeredEvents[e] = [], this;
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6860
|
+
var _ = [];
|
|
6861
|
+
class S extends O {
|
|
6862
|
+
/**
|
|
6863
|
+
* The unique identifier for the storage instance.
|
|
6864
|
+
*/
|
|
6865
|
+
id = "default";
|
|
6866
|
+
loaded = !1;
|
|
6867
|
+
data;
|
|
6868
|
+
constructor(e) {
|
|
6869
|
+
super(), this.id = e.id || this.id, this.data = e.data ?? {}, _.push(this), this.start();
|
|
6870
|
+
}
|
|
6871
|
+
SE_API = null;
|
|
6872
|
+
start() {
|
|
6873
|
+
tt?.then((e) => {
|
|
6874
|
+
this.SE_API = e, e.store.get(this.id).then((a) => {
|
|
6875
|
+
this.data = a ?? this.data, this.loaded = !0, this.emit("load", this.data), JSON.stringify(this.data) !== JSON.stringify(a) && this.emit("update", this.data);
|
|
6876
|
+
}).catch(() => {
|
|
6877
|
+
this.loaded = !0, this.emit("load", this.data);
|
|
6878
|
+
});
|
|
6879
|
+
});
|
|
6880
|
+
}
|
|
6881
|
+
/**
|
|
6882
|
+
* Saves the current data to storage.
|
|
6883
|
+
* @param data Data to save (defaults to current)
|
|
6884
|
+
*/
|
|
6885
|
+
save(e = this.data) {
|
|
6886
|
+
this.loaded && this.SE_API && (this.data = e, this.SE_API.store.set(this.id, this.data), this.emit("update", this.data));
|
|
6887
|
+
}
|
|
6888
|
+
/**
|
|
6889
|
+
* Updates the storage data and emits an update event
|
|
6890
|
+
* @param data Data to update (defaults to current)
|
|
6891
|
+
*/
|
|
6892
|
+
update(e = this.data) {
|
|
6893
|
+
this.loaded && JSON.stringify(this.data) !== JSON.stringify(e) && (this.data = { ...this.data, ...e }, this.save(this.data));
|
|
6894
|
+
}
|
|
6895
|
+
/**
|
|
6896
|
+
* Adds a value to the storage at the specified path.
|
|
6897
|
+
* @param path Path to add the value to
|
|
6898
|
+
* @param value Value to add
|
|
6899
|
+
*/
|
|
6900
|
+
add(e, a) {
|
|
6901
|
+
this.loaded && (S.setByPath(this.data, e, a), this.save(this.data));
|
|
6902
|
+
}
|
|
6903
|
+
/**
|
|
6904
|
+
* Clears all data from the storage.
|
|
6905
|
+
*/
|
|
6906
|
+
clear() {
|
|
6907
|
+
this.loaded && (this.data = {}, this.save(this.data));
|
|
6908
|
+
}
|
|
6909
|
+
/**
|
|
6910
|
+
* Sets a value in the storage at the specified path.
|
|
6911
|
+
* @param obj The object to set the value in
|
|
6912
|
+
* @param path The path to set the value at
|
|
6913
|
+
* @param value The value to set
|
|
6914
|
+
* @returns The updated object
|
|
6915
|
+
*/
|
|
6916
|
+
static setByPath(e, a, o) {
|
|
6917
|
+
const i = a.split(".");
|
|
6918
|
+
let t = e;
|
|
6919
|
+
for (let n = 0; n < i.length - 1; n++)
|
|
6920
|
+
(typeof t[i[n]] != "object" || t[i[n]] == null) && (t[i[n]] = {}), t = t[i[n]];
|
|
6921
|
+
return t[i[i.length - 1]] = o, t;
|
|
6922
|
+
}
|
|
6923
|
+
on(e, a) {
|
|
6924
|
+
return e === "load" && this.loaded ? (a.apply(this, [this.data]), this) : (super.on(e, a), this);
|
|
7343
6925
|
}
|
|
7344
|
-
};
|
|
7345
|
-
async function ft() {
|
|
7346
|
-
let s = localStorage.getItem("SE_API-STORE") ?? "", e = s ? JSON.parse(s) : {};
|
|
7347
|
-
return Y.store.list = e, Y;
|
|
7348
6926
|
}
|
|
7349
6927
|
class bt extends O {
|
|
7350
6928
|
instance;
|
|
@@ -7486,29 +7064,258 @@ class bt extends O {
|
|
|
7486
7064
|
subType: "community"
|
|
7487
7065
|
});
|
|
7488
7066
|
}
|
|
7489
|
-
}, this.instance.onGiftSubContinue = (e, a, o) => {
|
|
7490
|
-
this.emit("giftSubContinue", e, a, o), client.debug && k.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${a}`), this.emulate && x.emulate.twitch.subscriber({
|
|
7491
|
-
name: e,
|
|
7492
|
-
message: "",
|
|
7493
|
-
sender: a,
|
|
7494
|
-
tier: "1000",
|
|
7495
|
-
subType: "gift"
|
|
7496
|
-
});
|
|
7497
|
-
}, this.instance.onCheer = (e, a, o, i, t) => {
|
|
7498
|
-
this.emit("cheer", e, a, o, i, t), client.debug && k.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${o} bits - ${a}`), this.emulate && x.emulate.twitch.cheer({
|
|
7499
|
-
name: e,
|
|
7500
|
-
message: a,
|
|
7501
|
-
amount: o
|
|
7502
|
-
});
|
|
7503
|
-
}, this.instance.onChatMode = (e, a) => {
|
|
7504
|
-
this.emit("chatMode", e, a), client.debug && k.debug("[Client]", `ComfyJS Chat Mode Changed on ${a}`);
|
|
7505
|
-
}, this.instance.onReward = (e, a, o, i, t) => {
|
|
7506
|
-
this.emit("reward", e, a, o, i, t), client.debug && k.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${a} for ${o} - ${i}`);
|
|
7507
|
-
}, this.instance.onConnected = (e, a, o) => {
|
|
7508
|
-
this.emit("connected", e, a, o), client.debug && k.debug("[Client]", `ComfyJS Connected: ${e}:${a} (First Connect: ${o})`);
|
|
7509
|
-
}, this.instance.onReconnect = (e) => {
|
|
7510
|
-
this.emit("reconnect", e), client.debug && k.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
7511
|
-
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
7067
|
+
}, this.instance.onGiftSubContinue = (e, a, o) => {
|
|
7068
|
+
this.emit("giftSubContinue", e, a, o), client.debug && k.debug("[Client]", `ComfyJS Gift Sub Continue: ${e} continued their gifted sub from ${a}`), this.emulate && x.emulate.twitch.subscriber({
|
|
7069
|
+
name: e,
|
|
7070
|
+
message: "",
|
|
7071
|
+
sender: a,
|
|
7072
|
+
tier: "1000",
|
|
7073
|
+
subType: "gift"
|
|
7074
|
+
});
|
|
7075
|
+
}, this.instance.onCheer = (e, a, o, i, t) => {
|
|
7076
|
+
this.emit("cheer", e, a, o, i, t), client.debug && k.debug("[Client]", `ComfyJS Cheer: ${e} cheered ${o} bits - ${a}`), this.emulate && x.emulate.twitch.cheer({
|
|
7077
|
+
name: e,
|
|
7078
|
+
message: a,
|
|
7079
|
+
amount: o
|
|
7080
|
+
});
|
|
7081
|
+
}, this.instance.onChatMode = (e, a) => {
|
|
7082
|
+
this.emit("chatMode", e, a), client.debug && k.debug("[Client]", `ComfyJS Chat Mode Changed on ${a}`);
|
|
7083
|
+
}, this.instance.onReward = (e, a, o, i, t) => {
|
|
7084
|
+
this.emit("reward", e, a, o, i, t), client.debug && k.debug("[Client]", `ComfyJS Reward: ${e} redeemed ${a} for ${o} - ${i}`);
|
|
7085
|
+
}, this.instance.onConnected = (e, a, o) => {
|
|
7086
|
+
this.emit("connected", e, a, o), client.debug && k.debug("[Client]", `ComfyJS Connected: ${e}:${a} (First Connect: ${o})`);
|
|
7087
|
+
}, this.instance.onReconnect = (e) => {
|
|
7088
|
+
this.emit("reconnect", e), client.debug && k.debug("[Client]", `ComfyJS Reconnect: Attempt #${e}`);
|
|
7089
|
+
}, this.init && this.instance.Init(this.username, this.password, this.channels, this.isDebug);
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7092
|
+
class J extends O {
|
|
7093
|
+
id = "default";
|
|
7094
|
+
debug = !1;
|
|
7095
|
+
storage;
|
|
7096
|
+
fields = {};
|
|
7097
|
+
session;
|
|
7098
|
+
loaded = !1;
|
|
7099
|
+
constructor(e) {
|
|
7100
|
+
super(), this.id = e.id || this.id, this.storage = new S({
|
|
7101
|
+
id: this.id,
|
|
7102
|
+
data: {
|
|
7103
|
+
user: {},
|
|
7104
|
+
avatar: {},
|
|
7105
|
+
pronoun: {},
|
|
7106
|
+
emote: {}
|
|
7107
|
+
}
|
|
7108
|
+
}), this.on("load", () => {
|
|
7109
|
+
this.debug = !!(typeof e.debug == "function" ? e.debug() : e.debug);
|
|
7110
|
+
}), window.client = this;
|
|
7111
|
+
}
|
|
7112
|
+
actions = {
|
|
7113
|
+
commands: [],
|
|
7114
|
+
buttons: []
|
|
7115
|
+
};
|
|
7116
|
+
details;
|
|
7117
|
+
cache = {
|
|
7118
|
+
avatar: 30,
|
|
7119
|
+
pronoun: 60,
|
|
7120
|
+
emote: 120
|
|
7121
|
+
};
|
|
7122
|
+
on(e, a) {
|
|
7123
|
+
return e === "load" && this.loaded ? (a.apply(this, [
|
|
7124
|
+
{
|
|
7125
|
+
channel: this.details.user,
|
|
7126
|
+
currency: this.details.currency,
|
|
7127
|
+
fieldData: this.fields,
|
|
7128
|
+
recents: [],
|
|
7129
|
+
session: {
|
|
7130
|
+
data: this.session,
|
|
7131
|
+
settings: {
|
|
7132
|
+
autoReset: !1,
|
|
7133
|
+
calendar: !1,
|
|
7134
|
+
resetOnStart: !1
|
|
7135
|
+
}
|
|
7136
|
+
},
|
|
7137
|
+
overlay: this.details.overlay,
|
|
7138
|
+
emulated: !1
|
|
7139
|
+
}
|
|
7140
|
+
]), this) : (super.on(e, a), this);
|
|
7141
|
+
}
|
|
7142
|
+
}
|
|
7143
|
+
class R {
|
|
7144
|
+
prefix = "!";
|
|
7145
|
+
name;
|
|
7146
|
+
description;
|
|
7147
|
+
arguments = !1;
|
|
7148
|
+
test = `${this.prefix}${this.name} arg1 arg2`;
|
|
7149
|
+
aliases = [];
|
|
7150
|
+
permissions = void 0;
|
|
7151
|
+
admins = [];
|
|
7152
|
+
constructor(e) {
|
|
7153
|
+
window.client instanceof J && (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"));
|
|
7154
|
+
}
|
|
7155
|
+
run(e, a) {
|
|
7156
|
+
}
|
|
7157
|
+
verify(e, a, o) {
|
|
7158
|
+
return this.arguments === !0 && (!o || !o.length) ? !1 : this.admins.some((i) => e.toLocaleLowerCase() === i.toLocaleLowerCase()) ? !0 : this.permissions === !0 || typeof this.permissions > "u" || Array.isArray(this.permissions) && !this.permissions.length ? !1 : !!(Array.isArray(this.permissions) && this.permissions.some((i) => e.toLowerCase() === i.toLowerCase() || a.map((t) => t.toLowerCase()).includes(i.toLowerCase())));
|
|
7159
|
+
}
|
|
7160
|
+
parse(e, a) {
|
|
7161
|
+
if (!(window.client instanceof J)) return !1;
|
|
7162
|
+
const o = e.replace(this.prefix, "").split(" ").slice(1).map((r) => r.trim());
|
|
7163
|
+
var i = "", t = [];
|
|
7164
|
+
const n = { bits: "cheer", premium: "prime" };
|
|
7165
|
+
switch (a.provider) {
|
|
7166
|
+
case "twitch": {
|
|
7167
|
+
const r = a.data;
|
|
7168
|
+
i = r.event.data.nick || r.event.data.displayName, r.event.data.tags?.badges && (t = r.event.data.tags.badges.toString().replace(/\/\d+/g, "").split(",").map((l) => l in n ? n[l] : l));
|
|
7169
|
+
break;
|
|
7170
|
+
}
|
|
7171
|
+
case "youtube": {
|
|
7172
|
+
const r = a.data, d = {
|
|
7173
|
+
isVerified: "verified",
|
|
7174
|
+
isChatOwner: "owner",
|
|
7175
|
+
isChatSponsor: "sponsor",
|
|
7176
|
+
isChatModerator: "moderator"
|
|
7177
|
+
};
|
|
7178
|
+
i = r.event.data.nick || r.event.data.displayName, t = Object.entries(r.event.data.authorDetails).filter(([l, m]) => l.startsWith("is") && m).map(([l]) => d[l]).filter(Boolean);
|
|
7179
|
+
break;
|
|
7180
|
+
}
|
|
7181
|
+
case "kick":
|
|
7182
|
+
return !1;
|
|
7183
|
+
}
|
|
7184
|
+
const c = this.verify(i, t, o);
|
|
7185
|
+
return c === !0 && this.run.apply(window.client, [o, a]), c;
|
|
7186
|
+
}
|
|
7187
|
+
remove() {
|
|
7188
|
+
if (!(window.client instanceof J)) return;
|
|
7189
|
+
const e = window.client.actions.commands.indexOf(this);
|
|
7190
|
+
e > -1 && (window.client.actions.commands.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
7191
|
+
}
|
|
7192
|
+
static execute(e) {
|
|
7193
|
+
if (!(window.client instanceof J)) return !1;
|
|
7194
|
+
const a = e.data;
|
|
7195
|
+
try {
|
|
7196
|
+
if (window.client.actions.commands.length && window.client.actions.commands.some((o) => a.event.data.text.startsWith(o.prefix))) {
|
|
7197
|
+
const o = window.client.actions.commands.filter((i) => {
|
|
7198
|
+
var t = [i.name, ...i.aliases ?? []], n = a.event.data.text.replace(i.prefix, "").split(" ")[0];
|
|
7199
|
+
return t.includes(n);
|
|
7200
|
+
});
|
|
7201
|
+
if (o.length && o.every((i) => i instanceof R))
|
|
7202
|
+
return o.forEach((i) => {
|
|
7203
|
+
i.parse(a.event.data.text, e), window.client.emit("action", i, "executed"), k.received(`Command executed: ${a.event.data.text} by ${a.event.data.nick || a.event.data.displayName}`, a);
|
|
7204
|
+
}), !0;
|
|
7205
|
+
}
|
|
7206
|
+
} catch {
|
|
7207
|
+
return !1;
|
|
7208
|
+
} finally {
|
|
7209
|
+
return !1;
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7213
|
+
class Z extends O {
|
|
7214
|
+
queue = [];
|
|
7215
|
+
priorityQueue = [];
|
|
7216
|
+
history = [];
|
|
7217
|
+
timeouts = [];
|
|
7218
|
+
running = !1;
|
|
7219
|
+
duration = void 0;
|
|
7220
|
+
loaded = !1;
|
|
7221
|
+
processor;
|
|
7222
|
+
constructor(e) {
|
|
7223
|
+
if (super(), !(window.client instanceof J))
|
|
7224
|
+
throw new Error("useQueue can only be instantiated after the Client is initialized.");
|
|
7225
|
+
if (!e.processor || typeof e.processor != "function")
|
|
7226
|
+
throw new Error("A valid processor function must be provided to useQueue.");
|
|
7227
|
+
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), window.client.on("load", () => {
|
|
7228
|
+
e.duration === "client" && (this.duration = window.client.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0;
|
|
7229
|
+
});
|
|
7230
|
+
}
|
|
7231
|
+
enqueue(e, a = {}) {
|
|
7232
|
+
const o = {
|
|
7233
|
+
isoDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7234
|
+
isLoop: a?.isLoop ?? !1,
|
|
7235
|
+
isPriority: a?.isPriority ?? !1,
|
|
7236
|
+
isImmediate: a?.isImmediate ?? !1,
|
|
7237
|
+
value: e
|
|
7238
|
+
}, i = this.hasItems();
|
|
7239
|
+
return o.isPriority && o.isImmediate ? (this.cancel(), this.priorityQueue.unshift(o)) : (o.isPriority ? this.priorityQueue : this.queue).push(o), this.running === !1 && i === !1 && this.run(), this.emit("update", this.queue, this.priorityQueue, this.history, this.timeouts), this;
|
|
7240
|
+
}
|
|
7241
|
+
async run() {
|
|
7242
|
+
if (!this.hasItems()) {
|
|
7243
|
+
this.running = !1;
|
|
7244
|
+
return;
|
|
7245
|
+
}
|
|
7246
|
+
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();
|
|
7247
|
+
}
|
|
7248
|
+
async next() {
|
|
7249
|
+
const e = this.priorityQueue.length > 0 ? this.priorityQueue.shift() : this.queue.shift();
|
|
7250
|
+
if (!e) {
|
|
7251
|
+
this.running = !1;
|
|
7252
|
+
return;
|
|
7253
|
+
}
|
|
7254
|
+
try {
|
|
7255
|
+
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
7256
|
+
} catch (o) {
|
|
7257
|
+
k.error(`Error during item processing: ${o instanceof Error ? o.message : String(o)}`);
|
|
7258
|
+
}
|
|
7259
|
+
this.history.push(e);
|
|
7260
|
+
const a = e.isPriority ? this.priorityQueue : this.queue;
|
|
7261
|
+
e.isLoop && a.push(e);
|
|
7262
|
+
}
|
|
7263
|
+
resume() {
|
|
7264
|
+
return this.running && this.cancel(), this.hasItems() && this.run(), this;
|
|
7265
|
+
}
|
|
7266
|
+
update(e) {
|
|
7267
|
+
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;
|
|
7268
|
+
}
|
|
7269
|
+
cancel() {
|
|
7270
|
+
this.running && (this.timeouts.forEach((e) => clearTimeout(e)), this.timeouts = [], this.running = !1, this.emit("cancel"));
|
|
7271
|
+
}
|
|
7272
|
+
hasItems() {
|
|
7273
|
+
return this.queue.length > 0 || this.priorityQueue.length > 0;
|
|
7274
|
+
}
|
|
7275
|
+
on(e, a) {
|
|
7276
|
+
return e === "load" && this.loaded ? (a.apply(this), this) : (super.on(e, a), this);
|
|
7277
|
+
}
|
|
7278
|
+
}
|
|
7279
|
+
class q {
|
|
7280
|
+
field = "button";
|
|
7281
|
+
template = "button";
|
|
7282
|
+
run;
|
|
7283
|
+
constructor(e) {
|
|
7284
|
+
window.client instanceof J && (this.field = e.field ?? this.field, this.template = e.template ?? this.template, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
|
|
7285
|
+
}
|
|
7286
|
+
parse(e, a) {
|
|
7287
|
+
var o = e.replace(typeof this.field == "string" ? this.field : this.template.replace(/\{[^}]*\}/g, "") ?? "", "").trim();
|
|
7288
|
+
try {
|
|
7289
|
+
this.run.apply(window.client, [o.length ? o : e ?? e, a]);
|
|
7290
|
+
} catch (i) {
|
|
7291
|
+
throw new Error(`Error running button "${this.field}": ${i instanceof Error ? i.message : i}`);
|
|
7292
|
+
}
|
|
7293
|
+
return this;
|
|
7294
|
+
}
|
|
7295
|
+
remove() {
|
|
7296
|
+
if (!(window.client instanceof J)) return;
|
|
7297
|
+
const e = window.client.actions.buttons.indexOf(this);
|
|
7298
|
+
e > -1 && (window.client.actions.buttons.splice(e, 1), window.client.emit("action", this, "removed"));
|
|
7299
|
+
}
|
|
7300
|
+
static execute(e, a) {
|
|
7301
|
+
try {
|
|
7302
|
+
if (!(window.client instanceof J)) return !1;
|
|
7303
|
+
if (window.client.actions.buttons.length) {
|
|
7304
|
+
const o = window.client.actions.buttons.filter((i) => typeof i.field == "string" ? i.field === e : typeof i.field == "function" ? i.field(e, a) : !1);
|
|
7305
|
+
if (o.length && o.every((i) => i instanceof q))
|
|
7306
|
+
return o.forEach((i) => {
|
|
7307
|
+
try {
|
|
7308
|
+
i.parse(e, a), window.client.emit("action", i, "executed"), k.received(`Button executed: ${e}${a ? ` with value: ${a}` : ""}`);
|
|
7309
|
+
} catch (t) {
|
|
7310
|
+
k.error(`Error executing button "${e}": ${t instanceof Error ? t.message : t}`);
|
|
7311
|
+
}
|
|
7312
|
+
}), !0;
|
|
7313
|
+
}
|
|
7314
|
+
} catch {
|
|
7315
|
+
return !1;
|
|
7316
|
+
} finally {
|
|
7317
|
+
return !1;
|
|
7318
|
+
}
|
|
7512
7319
|
}
|
|
7513
7320
|
}
|
|
7514
7321
|
class $ {
|
|
@@ -7619,6 +7426,204 @@ class $ {
|
|
|
7619
7426
|
!this.enabled || !console.timeEnd || console.timeEnd(e);
|
|
7620
7427
|
}
|
|
7621
7428
|
}
|
|
7429
|
+
window.addEventListener("load", () => {
|
|
7430
|
+
window.client instanceof J && (x.queue = new Z({
|
|
7431
|
+
duration: "client",
|
|
7432
|
+
processor: async function(e) {
|
|
7433
|
+
if (window.dispatchEvent(new CustomEvent(e.listener, { detail: e.data })), e.listener === "onEventReceived" && e.session) {
|
|
7434
|
+
const a = await x.generate.event.onSessionUpdate(client.session, X(e.data));
|
|
7435
|
+
window.dispatchEvent(new CustomEvent("onSessionUpdate", { detail: a }));
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
}));
|
|
7439
|
+
});
|
|
7440
|
+
window.addEventListener("onWidgetLoad", async (s) => {
|
|
7441
|
+
const { detail: e } = s;
|
|
7442
|
+
if (window.client instanceof J) {
|
|
7443
|
+
const a = window.client;
|
|
7444
|
+
a.fields = e.fieldData, a.session = e.session.data, a.details = {
|
|
7445
|
+
...a.details,
|
|
7446
|
+
user: e.channel,
|
|
7447
|
+
currency: e.currency,
|
|
7448
|
+
overlay: e.overlay
|
|
7449
|
+
}, e.channel.id && !e.emulated ? await fetch(`https://api.streamelements.com/kappa/v2/channels/${e.channel.id}/`).then((o) => o.json()).then((o) => {
|
|
7450
|
+
if (o.provider)
|
|
7451
|
+
return a.details.provider = o.provider, o.provider;
|
|
7452
|
+
a.details.provider = "local";
|
|
7453
|
+
}).catch(() => {
|
|
7454
|
+
a.details.provider = "local";
|
|
7455
|
+
}) : a.details.provider = "local", a.emit("load", e), a.loaded = !0, a.storage.on("load", (o) => {
|
|
7456
|
+
if (a.debug && o ? k.debug("[Client]", "Storage loaded for client", `"${a.id}";`, `Provider: "${a.details.provider}";`, o) : a.debug && k.debug("[Client]", "Storage loaded for client", `"${a.id}";`, `Provider: "${a.details.provider}";`, "No data found."), o) {
|
|
7457
|
+
const i = (d) => {
|
|
7458
|
+
const l = Date.now(), m = {};
|
|
7459
|
+
for (const u in d)
|
|
7460
|
+
if (d.hasOwnProperty(u)) {
|
|
7461
|
+
const f = d[u];
|
|
7462
|
+
f.expire && f.expire > l && (m[u] = f);
|
|
7463
|
+
}
|
|
7464
|
+
return m;
|
|
7465
|
+
}, t = i(o.user || {}), n = i(o.avatar || {}), c = i(o.pronoun || {}), r = i(o.emote || {});
|
|
7466
|
+
a.storage.update({
|
|
7467
|
+
user: t,
|
|
7468
|
+
avatar: n,
|
|
7469
|
+
pronoun: c,
|
|
7470
|
+
emote: r
|
|
7471
|
+
});
|
|
7472
|
+
}
|
|
7473
|
+
e.channel.providerId.length && a.storage.add(`avatar.${e.channel.providerId.toLowerCase()}`, {
|
|
7474
|
+
value: e.channel.avatar,
|
|
7475
|
+
timestamp: Date.now(),
|
|
7476
|
+
expire: Date.now() + a.cache.avatar * 60 * 1e3
|
|
7477
|
+
});
|
|
7478
|
+
});
|
|
7479
|
+
}
|
|
7480
|
+
});
|
|
7481
|
+
window.addEventListener("onSessionUpdate", (s) => {
|
|
7482
|
+
const { detail: e } = s;
|
|
7483
|
+
if (window.client instanceof J) {
|
|
7484
|
+
const a = window.client;
|
|
7485
|
+
a.session = e.session, a.emit("session", e.session), a.debug && k.debug("[Client]", "Session updated", e.session);
|
|
7486
|
+
}
|
|
7487
|
+
});
|
|
7488
|
+
function X(s) {
|
|
7489
|
+
var e = s.event?.provider || s.event?.service || s.event?.data?.provider || window.client.details.provider;
|
|
7490
|
+
return [
|
|
7491
|
+
"kvstore:update",
|
|
7492
|
+
"bot:counter",
|
|
7493
|
+
"alertService:toggleSound",
|
|
7494
|
+
"tip-latest",
|
|
7495
|
+
"event:test",
|
|
7496
|
+
"event:skip"
|
|
7497
|
+
].some((i) => i === s.listener) && (e = "streamelements"), { provider: e, data: s };
|
|
7498
|
+
}
|
|
7499
|
+
window.addEventListener("onEventReceived", ({ detail: s }) => {
|
|
7500
|
+
if (window.client instanceof J) {
|
|
7501
|
+
const a = X(s);
|
|
7502
|
+
switch (a.provider) {
|
|
7503
|
+
case "streamelements": {
|
|
7504
|
+
const i = a.data;
|
|
7505
|
+
switch (i.listener) {
|
|
7506
|
+
case "tip-latest": {
|
|
7507
|
+
i.event;
|
|
7508
|
+
break;
|
|
7509
|
+
}
|
|
7510
|
+
case "event:skip": {
|
|
7511
|
+
i.event;
|
|
7512
|
+
break;
|
|
7513
|
+
}
|
|
7514
|
+
case "event:test": {
|
|
7515
|
+
switch (i.event.listener) {
|
|
7516
|
+
case "widget-button": {
|
|
7517
|
+
const t = i.event;
|
|
7518
|
+
q.execute(t.field, t.value);
|
|
7519
|
+
break;
|
|
7520
|
+
}
|
|
7521
|
+
case "subscriber-latest": {
|
|
7522
|
+
i.event;
|
|
7523
|
+
break;
|
|
7524
|
+
}
|
|
7525
|
+
}
|
|
7526
|
+
break;
|
|
7527
|
+
}
|
|
7528
|
+
case "kvstore:update": {
|
|
7529
|
+
const t = i.event;
|
|
7530
|
+
if (_.length) {
|
|
7531
|
+
var e = _.find((n) => n.id === t.data.key.replace("customWidget.", ""));
|
|
7532
|
+
e && e.update(t.data.value);
|
|
7533
|
+
}
|
|
7534
|
+
break;
|
|
7535
|
+
}
|
|
7536
|
+
case "bot:counter": {
|
|
7537
|
+
i.event;
|
|
7538
|
+
break;
|
|
7539
|
+
}
|
|
7540
|
+
case "alertService:toggleSound": {
|
|
7541
|
+
const t = i.event;
|
|
7542
|
+
client.details.overlay.muted = !!t.muted;
|
|
7543
|
+
break;
|
|
7544
|
+
}
|
|
7545
|
+
}
|
|
7546
|
+
window.client.emit("event", "streamelements", a.data);
|
|
7547
|
+
break;
|
|
7548
|
+
}
|
|
7549
|
+
case "twitch": {
|
|
7550
|
+
const i = a.data;
|
|
7551
|
+
switch (i.listener) {
|
|
7552
|
+
case "delete-message": {
|
|
7553
|
+
i.event;
|
|
7554
|
+
break;
|
|
7555
|
+
}
|
|
7556
|
+
case "delete-messages": {
|
|
7557
|
+
i.event;
|
|
7558
|
+
break;
|
|
7559
|
+
}
|
|
7560
|
+
case "message": {
|
|
7561
|
+
i.event, R.execute({ provider: "twitch", data: i });
|
|
7562
|
+
break;
|
|
7563
|
+
}
|
|
7564
|
+
case "follower-latest": {
|
|
7565
|
+
i.event;
|
|
7566
|
+
break;
|
|
7567
|
+
}
|
|
7568
|
+
case "cheer-latest": {
|
|
7569
|
+
i.event;
|
|
7570
|
+
break;
|
|
7571
|
+
}
|
|
7572
|
+
case "subscriber-latest": {
|
|
7573
|
+
(!i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && i.event.isCommunityGift || !i.event.gifted && i.event.bulkGifted && !i.event.isCommunityGift) && i.event;
|
|
7574
|
+
break;
|
|
7575
|
+
}
|
|
7576
|
+
case "raid-latest": {
|
|
7577
|
+
i.event;
|
|
7578
|
+
break;
|
|
7579
|
+
}
|
|
7580
|
+
}
|
|
7581
|
+
window.client.emit("event", "twitch", a.data);
|
|
7582
|
+
break;
|
|
7583
|
+
}
|
|
7584
|
+
case "youtube": {
|
|
7585
|
+
const i = a.data;
|
|
7586
|
+
switch (i.listener) {
|
|
7587
|
+
case "message": {
|
|
7588
|
+
i.event, R.execute({ provider: "youtube", data: i });
|
|
7589
|
+
break;
|
|
7590
|
+
}
|
|
7591
|
+
case "subscriber-latest": {
|
|
7592
|
+
i.event;
|
|
7593
|
+
break;
|
|
7594
|
+
}
|
|
7595
|
+
case "sponsor-latest": {
|
|
7596
|
+
i.event, (!i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && !i.event.isCommunityGift || i.event.gifted && !i.event.bulkGifted && i.event.isCommunityGift || !i.event.gifted && i.event.bulkGifted && !i.event.isCommunityGift) && i.event;
|
|
7597
|
+
break;
|
|
7598
|
+
}
|
|
7599
|
+
case "superchat-latest": {
|
|
7600
|
+
i.event;
|
|
7601
|
+
break;
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7604
|
+
window.client.emit("event", "youtube", a.data);
|
|
7605
|
+
break;
|
|
7606
|
+
}
|
|
7607
|
+
case "kick": {
|
|
7608
|
+
a.data, window.client.emit("event", "kick", a.data);
|
|
7609
|
+
break;
|
|
7610
|
+
}
|
|
7611
|
+
case "facebook": {
|
|
7612
|
+
a.data, window.client.emit("event", "facebook", a.data);
|
|
7613
|
+
break;
|
|
7614
|
+
}
|
|
7615
|
+
}
|
|
7616
|
+
const o = [
|
|
7617
|
+
"bot:counter",
|
|
7618
|
+
"alertService:toggleSound",
|
|
7619
|
+
"event",
|
|
7620
|
+
"event:skip",
|
|
7621
|
+
"event:test",
|
|
7622
|
+
"kvstore:update"
|
|
7623
|
+
];
|
|
7624
|
+
client.debug && !o.some((i) => i === a.data.listener) && k.received("[Client]", `Event ${a.data.listener} received from ${a.provider}`, a.data.event);
|
|
7625
|
+
}
|
|
7626
|
+
});
|
|
7622
7627
|
const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft()), k = new $(), yt = {
|
|
7623
7628
|
Client: J,
|
|
7624
7629
|
USE_SE_API: tt,
|
|
@@ -7629,15 +7634,16 @@ const tt = typeof SE_API < "u" ? Promise.resolve(SE_API) : Promise.resolve(ft())
|
|
|
7629
7634
|
findEmotesInText: F,
|
|
7630
7635
|
replaceEmotesWithHTML: B,
|
|
7631
7636
|
replaceYoutubeEmotesWithHTML: pt,
|
|
7632
|
-
generateBadges: K
|
|
7637
|
+
generateBadges: K,
|
|
7638
|
+
parseProvider: X
|
|
7633
7639
|
},
|
|
7634
7640
|
modules: {
|
|
7635
|
-
Button:
|
|
7641
|
+
Button: q,
|
|
7636
7642
|
Command: R,
|
|
7637
7643
|
EventProvider: O,
|
|
7638
7644
|
useComfyJs: bt,
|
|
7639
7645
|
useStorage: S,
|
|
7640
|
-
useQueue:
|
|
7646
|
+
useQueue: Z,
|
|
7641
7647
|
Logger: $
|
|
7642
7648
|
},
|
|
7643
7649
|
data: {
|