@tixyel/streamelements 7.2.0 → 7.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 +25 -2
- package/dist/index.es.js +41 -6
- 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.d.ts
CHANGED
|
@@ -3028,8 +3028,31 @@ declare class UtilsHelper {
|
|
|
3028
3028
|
* // }
|
|
3029
3029
|
* ```
|
|
3030
3030
|
*/
|
|
3031
|
-
identifyUser(provider: 'twitch', receivedEvent: StreamElements.Event.Provider.Twitch.Message, session: StreamElements.Session.Data): Promise<IdentifyTwitchResult
|
|
3032
|
-
identifyUser(provider: 'youtube', receivedEvent: StreamElements.Event.Provider.YouTube.Message, session: StreamElements.Session.Data): Promise<IdentifyYouTubeResult
|
|
3031
|
+
identifyUser(provider: 'twitch', receivedEvent: StreamElements.Event.Provider.Twitch.Message, session: StreamElements.Session.Data): Promise<IdentifyTwitchResult>;
|
|
3032
|
+
identifyUser(provider: 'youtube', receivedEvent: StreamElements.Event.Provider.YouTube.Message, session: StreamElements.Session.Data): Promise<IdentifyYouTubeResult>;
|
|
3033
|
+
identifyMessage(provider: 'twitch', receivedEvent: StreamElements.Event.Provider.Twitch.Message, options?: {
|
|
3034
|
+
mapEmote?: (emote: {
|
|
3035
|
+
src: string;
|
|
3036
|
+
alt: string;
|
|
3037
|
+
}) => string;
|
|
3038
|
+
allowedRoles: RequireAtLeastOne<Twitch.tags>[];
|
|
3039
|
+
}): {
|
|
3040
|
+
username: string;
|
|
3041
|
+
text: string;
|
|
3042
|
+
reply: {
|
|
3043
|
+
login: string;
|
|
3044
|
+
name: string;
|
|
3045
|
+
userId: string;
|
|
3046
|
+
msgId: string;
|
|
3047
|
+
text: string;
|
|
3048
|
+
} | undefined;
|
|
3049
|
+
msgId: string;
|
|
3050
|
+
userId: string;
|
|
3051
|
+
emote: {
|
|
3052
|
+
only: boolean;
|
|
3053
|
+
amount: number;
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3033
3056
|
}
|
|
3034
3057
|
type TopType = {
|
|
3035
3058
|
gifter: boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -9280,14 +9280,16 @@ var T = class {
|
|
|
9280
9280
|
replaceEmotesWithHTML(e, t) {
|
|
9281
9281
|
if (!t.length) return e;
|
|
9282
9282
|
let n = "", r = 0;
|
|
9283
|
-
return t.filter((e) => e.type !== "emoji").forEach((t) => {
|
|
9283
|
+
return t.filter((e) => e.type !== "emoji").sort((e, t) => e.start - t.start).forEach((t) => {
|
|
9284
9284
|
if (t.start < r) return;
|
|
9285
9285
|
n += e.substring(r, t.start);
|
|
9286
9286
|
let i = Array.from({
|
|
9287
9287
|
...t.urls,
|
|
9288
9288
|
length: 5
|
|
9289
9289
|
}).slice(1).reverse().filter(Boolean)[0] || t.urls[1];
|
|
9290
|
-
n += `<img src="${i}" alt="${t.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;"
|
|
9290
|
+
n += `<img src="${i}" alt="${t.name}" class="emote" style="width: auto; height: 1em; vertical-align: middle;" />`;
|
|
9291
|
+
let a = t.start + t.name.length;
|
|
9292
|
+
r = t.end === a - 1 ? t.end + 1 : t.end;
|
|
9291
9293
|
}), n += e.substring(r), n;
|
|
9292
9294
|
}
|
|
9293
9295
|
hasOnlyEmotes(e, t) {
|
|
@@ -10446,19 +10448,19 @@ var M = class {
|
|
|
10446
10448
|
});
|
|
10447
10449
|
switch (e) {
|
|
10448
10450
|
case "twitch": {
|
|
10449
|
-
let e = t.event.data, i =
|
|
10451
|
+
let e = t.event.data, i = !1;
|
|
10452
|
+
return e.tags["badge-info"]?.includes("subscriber") && (i = await this.findSubscriptionTier({
|
|
10450
10453
|
userId: e.userId,
|
|
10451
10454
|
name: e.displayName,
|
|
10452
10455
|
broadcasterId: e.tags["room-id"]
|
|
10453
|
-
}, n ?? {}, !1)
|
|
10454
|
-
return {
|
|
10456
|
+
}, n ?? {}, !1)), {
|
|
10455
10457
|
id: e.userId,
|
|
10456
10458
|
name: e.displayName,
|
|
10457
10459
|
color: e.displayColor,
|
|
10458
10460
|
role: e.tags.badges.split(",")[0].split("/")[0],
|
|
10459
10461
|
tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
|
|
10460
10462
|
badges: e.badges,
|
|
10461
|
-
tier:
|
|
10463
|
+
tier: i || void 0,
|
|
10462
10464
|
top: r(e.displayName)
|
|
10463
10465
|
};
|
|
10464
10466
|
}
|
|
@@ -10474,6 +10476,39 @@ var M = class {
|
|
|
10474
10476
|
}
|
|
10475
10477
|
}
|
|
10476
10478
|
}
|
|
10479
|
+
identifyMessage(e, t, n) {
|
|
10480
|
+
let r = /<img[^>]*class="emote"[^>]*>/gi;
|
|
10481
|
+
switch (e) {
|
|
10482
|
+
case "twitch": {
|
|
10483
|
+
let e = t.event, i = new E().replaceEmotesWithHTML(t.event.data.text, t.event.data.emotes), a = i.replaceAll(r, "").trim() === "", o = (i.match(r) || []).length;
|
|
10484
|
+
i = i.replace(r, (e) => {
|
|
10485
|
+
let t = e.match(/src="([^"]*)"/), r = e.match(/alt="([^"]*)"/), i = t ? t[1] : "", a = r ? r[1] : "";
|
|
10486
|
+
return n?.mapEmote ? n.mapEmote({
|
|
10487
|
+
src: i,
|
|
10488
|
+
alt: a
|
|
10489
|
+
}) : `<img src="${i}" alt="${a}" class="emote" style="display: inline-block; width: auto; height: 1em; vertical-align: middle;">`;
|
|
10490
|
+
});
|
|
10491
|
+
let s = t.event.data.tags["reply-parent-msg-id"] ? {
|
|
10492
|
+
login: t.event.data.tags["reply-parent-user-login"],
|
|
10493
|
+
name: t.event.data.tags["reply-parent-display-name"],
|
|
10494
|
+
userId: t.event.data.tags["reply-parent-user-id"],
|
|
10495
|
+
msgId: t.event.data.tags["reply-parent-msg-id"],
|
|
10496
|
+
text: t.event.data.tags["reply-parent-msg-body"]
|
|
10497
|
+
} : void 0;
|
|
10498
|
+
return {
|
|
10499
|
+
username: t.event.data.displayName,
|
|
10500
|
+
text: i,
|
|
10501
|
+
reply: s,
|
|
10502
|
+
msgId: e.data.msgId,
|
|
10503
|
+
userId: e.data.userId,
|
|
10504
|
+
emote: {
|
|
10505
|
+
only: a,
|
|
10506
|
+
amount: o
|
|
10507
|
+
}
|
|
10508
|
+
};
|
|
10509
|
+
}
|
|
10510
|
+
}
|
|
10511
|
+
}
|
|
10477
10512
|
}, ne = class {
|
|
10478
10513
|
lerp(e, t, n) {
|
|
10479
10514
|
let r = Math.max(0, Math.min(1, n));
|