@tixyel/streamelements 7.0.3 → 7.0.5
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 +5 -2
- package/dist/index.es.js +63 -68
- 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
|
@@ -482,7 +482,8 @@ declare namespace Twitch {
|
|
|
482
482
|
click_url: string | null;
|
|
483
483
|
}>;
|
|
484
484
|
};
|
|
485
|
-
type
|
|
485
|
+
type CommonTags = 'no_video' | 'no_audio' | 'vip' | 'predictions' | 'lead_moderator' | 'moderator' | 'subscriber' | 'sub-gifter' | 'sub-gift-leader' | 'bits' | 'twitchbot' | 'staff' | 'admin' | 'partner' | 'turbo' | 'broadcaster' | 'hype-train' | 'bits' | 'bits-leader' | 'bot-badge' | 'founder' | 'admin' | 'extension' | 'game-developer' | 'global_mod' | 'artist-badge' | 'ambassador' | 'premium';
|
|
486
|
+
type tags = CommonTags | 'qsmp2' | 'jasontheween-7-day-survival' | 'support-a-streamer-ho26-badge' | 'twitch-recap-2025' | 'ugly-sweater' | 'fright-fest-2025' | 'gamerduo' | 'video-games-day' | 'twitch-intern-2022' | 'touch-grass' | 'twitchcon-referral-program-2025-chrome-star' | 'twitchcon-referral-program-2025-bleedpurple' | 'share-the-love' | 'gone-bananas' | 'twitchcon-2025---rotterdam' | 'clip-the-halls' | 'twitch-recap-2024' | 'subtember-2024' | 'twitch-intern-2024' | 'twitch-dj' | 'destiny-2-the-final-shape-streamer' | 'destiny-2-final-shape-raid-race' | 'twitchcon-2024---san-diego' | 'minecraft-15th-anniversary-celebration' | 'warcraft' | 'vga-champ-2017' | 'tyranny_1' | 'twitchconNA2023' | 'twitchconNA2020' | 'twitchconNA2022' | 'twitchconNA2019' | 'twitchconEU2023' | 'twitchconEU2022' | 'twitchcon2018' | 'twitchconAmsterdam2020' | 'twitchconEU2019' | 'twitchcon2017' | 'twitchcon-2024---rotterdam' | 'twitch-recap-2023' | 'twitch-intern-2023' | 'treasure-adventure-world_1' | 'titan-souls_1' | 'this-war-of-mine_1' | 'the-surge_2' | 'the-surge_1' | 'the-surge_3' | 'the-golden-predictor-of-the-game-awards-2023' | 'the-game-awards-2023' | 'superhot_1' | 'strafe_1' | 'streamer-awards-2024' | 'starbound_1' | 'samusoffer_beta' | 'rplace-2023' | 'rift_1' | 'raiden-v-directors-cut_1' | 'psychonauts_1' | 'overwatch-league-insider_2019B' | 'overwatch-league-insider_2019A' | 'okhlos_1' | 'overwatch-league-insider_2018B' | 'overwatch-league-insider_1' | 'kingdom-new-lands_1' | 'jackbox-party-pack_1' | 'innerspace_2' | 'innerspace_1' | 'hello_neighbor_1' | 'gold-pixel-heart' | 'heavy-bullets_1' | 'glitchcon2020' | 'glhf-pledge' | 'getting-over-it_2' | 'getting-over-it_1' | 'frozen-synapse_1' | 'frozen-cortext_1' | 'firewatch_1' | 'enter-the-gungeon_1' | 'duelyst_5' | 'duelyst_6' | 'duelyst_7' | 'duelyst_2' | 'duelyst_4' | 'duelyst_3' | 'duelyst_1' | 'devilian_1' | 'devil-may-cry-hd_4' | 'devil-may-cry-hd_3' | 'devil-may-cry-hd_2' | 'devil-may-cry-hd_1' | 'deceit_1' | 'darkest-dungeon_1' | 'cuphead_1' | 'clip-champ' | 'broken-age_1' | 'bubsy-the-woolies_1' | 'brawlhalla_1' | 'bits-charity' | 'battlechefbrigade_3' | 'battlerite_1' | 'battlechefbrigade_2' | 'battlechefbrigade_1' | 'axiom-verge_1' | 'anomaly-2_1' | 'anomaly-warzone-earth_1' | 'H1Z1_1' | '60-seconds_3' | '60-seconds_2' | '60-seconds_1' | '1979-revolution_1' | '10-years-as-twitch-staff' | '15-years-as-twitch-staff' | '5-years-as-twitch-staff' | 'aang' | 'alone' | 'anonymous-cheerer' | 'arc-raiders-launch-2025' | 'arcane-season-2-premiere' | 'battlefield-6' | 'bingbonglove' | 'black-ops-7-global-launch' | 'borderlands-4-badge---ripper' | 'borderlands-4-badge---vault-symbol' | 'bungie-foundation-ally' | 'bungie-foundation-supporter' | 'chatter-cs-go-2022' | 'clips-leader' | 'creator-cs-go-2022' | 'crimson-butterfly' | 'diablo-30th-anniversary' | 'diana' | 'ditto' | 'dragonscimmy' | 'dreamcon-2024' | 'elden-ring-recluse' | 'elden-ring-wylder' | 'eso_1' | 'evo-2025' | 'fallout-season-2-ghoul' | 'first-stand-2026-supporter' | 'first-stand-2026-viewer' | 'fischer' | 'frog-lantern' | 'gears-of-war-superfan-badge' | 'gingko-leaf' | 'gold-pixel-heart---together-for-good-24' | 'gp-explorer-3' | 'hornet' | 'hunt-crosses' | 'hypershot-celestial' | 'jeff-the-land-shark' | 'k4sen-con-2025' | 'kodama' | 'la-velada-iv' | 'la-velada-v-badge' | 'lamby' | 'league-of-legends-mid-season-invitational-2025---grey' | 'league-of-legends-mid-season-invitational-2025---purple' | 'legendus' | 'lol-worlds-2025' | 'lost-ark-anniversary' | 'low' | 'marathon-reveal-runner' | 'marathon-silkworm' | 'marathon-sub-burger' | 'mel' | 'moments' | 'mr-raccoon' | 'never-grave---witch-hat' | 'path-of-exile-2-badge' | 'pokemon-30th-anniversary' | 'pokemon-legends-z-a-chikorita' | 'pokemon-legends-z-a-tepig' | 'pokemon-legends-z-a-totodile' | 'power-rangers' | 'purple-noob' | 'purple-pixel-heart---together-for-good-24' | 'raging-wolf-helm' | 'raider-icon-badge' | 'rainbow-six-siege-x-10th-anniversary' | 'revedtv-stream-awards-2025' | 'ruby-pixel-heart---together-for-good-24' | 'rudy' | 'rustmas-2025' | 'sajam-slam-badge' | 'scampuss' | 'seeks-eye' | 'social-sharing' | 'sonic-racing-crossworlds' | 'speedons-5-badge' | 'stream-for-humanity-2-2025' | 'streamer-awards-tux' | 'subtember-2025' | 'superultracombo-2023' | 'survival-cup-4' | 'tft-paris-open' | 'the-deer' | 'the-first-descendant-badge' | 'the-man-without-fear' | 'the-onryos-mask' | 'together-for-good-25---good-badge' | 'together-for-good-25---gooder-badge' | 'together-for-good-25---goodest-badge' | 'together-for-good-25---wicked-dub-badge' | 'total-war-anniversary' | 'toxic-zombie' | 'twitchcon-2026-europe-row-houses' | 'twitchcon-2026-europe-windmill' | 'umbrella-corporation' | 'user-anniversary' | 'vct-paris-2025' | 'yellow-noob' | 'zevent-2024' | 'zevent25';
|
|
486
487
|
}
|
|
487
488
|
|
|
488
489
|
declare namespace TwitchEvents {
|
|
@@ -2573,6 +2574,7 @@ declare class MessageHelper {
|
|
|
2573
2574
|
* ```
|
|
2574
2575
|
*/
|
|
2575
2576
|
mapGlobalBadgeVersionAmount(type: Twitch.tags, variation: string | number): string;
|
|
2577
|
+
badgePriority: Twitch.tags[];
|
|
2576
2578
|
/**
|
|
2577
2579
|
* Generates badge data based on the provided badges and platform.
|
|
2578
2580
|
* @param badges - The badges to generate. Can be an array or a comma-separated string.
|
|
@@ -3013,7 +3015,8 @@ declare class UtilsHelper {
|
|
|
3013
3015
|
* // }
|
|
3014
3016
|
* ```
|
|
3015
3017
|
*/
|
|
3016
|
-
identifyUser(receivedEvent: StreamElements.Event.Provider.Twitch.Message
|
|
3018
|
+
identifyUser(provider: 'twitch', receivedEvent: StreamElements.Event.Provider.Twitch.Message, session: StreamElements.Session.Data): Promise<IdentifyTwitchResult | undefined>;
|
|
3019
|
+
identifyUser(provider: 'youtube', receivedEvent: StreamElements.Event.Provider.YouTube.Message, session: StreamElements.Session.Data): Promise<IdentifyYouTubeResult | undefined>;
|
|
3017
3020
|
}
|
|
3018
3021
|
type TopType = {
|
|
3019
3022
|
gifter: boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -9256,6 +9256,9 @@ var T = class {
|
|
|
9256
9256
|
return crypto.randomUUID();
|
|
9257
9257
|
}
|
|
9258
9258
|
}, E = class {
|
|
9259
|
+
constructor() {
|
|
9260
|
+
this.badgePriority = /* @__PURE__ */ "broadcaster.lead_moderator.moderator.vip.artist-badge.subscriber.sub-gift-leader.founder.sub-gifter.bits-leader.bits.admin.global_mod.staff.partner.ambassador.predictions.twitchbot.extension.game-developer.hype-train.bot-badge.turbo.premium.no_video.no_audio".split(".");
|
|
9261
|
+
}
|
|
9259
9262
|
findEmotesInText(e, t = w.emotes) {
|
|
9260
9263
|
let n = [];
|
|
9261
9264
|
return t.filter((e) => e.type !== "emoji").forEach((t) => {
|
|
@@ -9433,6 +9436,10 @@ var T = class {
|
|
|
9433
9436
|
!r.includes(e.id) && Array.isArray(r) ? r.push(e.id) : r = [e.id];
|
|
9434
9437
|
}
|
|
9435
9438
|
}
|
|
9439
|
+
r = r.sort((e, t) => {
|
|
9440
|
+
let n = this.badgePriority.indexOf(e), r = this.badgePriority.indexOf(t);
|
|
9441
|
+
return (n === -1 ? 2 ** 53 - 1 : n) - (r === -1 ? 2 ** 53 - 1 : r);
|
|
9442
|
+
});
|
|
9436
9443
|
var o;
|
|
9437
9444
|
switch (t) {
|
|
9438
9445
|
case "twitch": {
|
|
@@ -10247,11 +10254,7 @@ var M = class {
|
|
|
10247
10254
|
continue;
|
|
10248
10255
|
}
|
|
10249
10256
|
n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
|
|
10250
|
-
let i = o.length + 1, a = n.some((e) => [
|
|
10251
|
-
"subscriber",
|
|
10252
|
-
"prime",
|
|
10253
|
-
"founder"
|
|
10254
|
-
].includes(String(e).toLocaleLowerCase())), s = new I(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
|
|
10257
|
+
let i = o.length + 1, a = n.some((e) => ["subscriber"].includes(String(e).toLocaleLowerCase())), s = new I(`fake_user_${i.toString().padStart(2, "0")}_${Math.random().toString(36).slice(2, 8)}+${this.id}`, e, n, a, a ? t.getRandomSubTier() : void 0);
|
|
10255
10258
|
o.push(s);
|
|
10256
10259
|
}
|
|
10257
10260
|
return o.length < i.length && this.emit("warn", /* @__PURE__ */ Error("Some users could not be assigned badges due to limits. Consider increasing limits or adding more badges.")), o;
|
|
@@ -10381,100 +10384,92 @@ var M = class {
|
|
|
10381
10384
|
}
|
|
10382
10385
|
return 1;
|
|
10383
10386
|
}
|
|
10384
|
-
async identifyUser(e, t) {
|
|
10385
|
-
let
|
|
10386
|
-
gifter:
|
|
10387
|
+
async identifyUser(e, t, n) {
|
|
10388
|
+
let r = (e) => ({
|
|
10389
|
+
gifter: n["subscriber-alltime-gifter"].name === e,
|
|
10387
10390
|
tip: {
|
|
10388
10391
|
session: {
|
|
10389
|
-
donator:
|
|
10390
|
-
donation:
|
|
10392
|
+
donator: n["tip-session-top-donator"].name === e,
|
|
10393
|
+
donation: n["tip-session-top-donation"].name === e
|
|
10391
10394
|
},
|
|
10392
10395
|
weekly: {
|
|
10393
|
-
donator:
|
|
10394
|
-
donation:
|
|
10396
|
+
donator: n["tip-weekly-top-donator"].name === e,
|
|
10397
|
+
donation: n["tip-weekly-top-donation"].name === e
|
|
10395
10398
|
},
|
|
10396
10399
|
monthly: {
|
|
10397
|
-
donator:
|
|
10398
|
-
donation:
|
|
10400
|
+
donator: n["tip-monthly-top-donator"].name === e,
|
|
10401
|
+
donation: n["tip-monthly-top-donation"].name === e
|
|
10399
10402
|
},
|
|
10400
10403
|
alltime: {
|
|
10401
|
-
donator:
|
|
10402
|
-
donation:
|
|
10404
|
+
donator: n["tip-alltime-top-donator"].name === e,
|
|
10405
|
+
donation: n["tip-alltime-top-donation"].name === e
|
|
10403
10406
|
}
|
|
10404
10407
|
},
|
|
10405
10408
|
cheer: {
|
|
10406
10409
|
session: {
|
|
10407
|
-
donator:
|
|
10408
|
-
amount:
|
|
10410
|
+
donator: n["cheer-session-top-donator"].name === e,
|
|
10411
|
+
amount: n["cheer-session-top-donation"].name === e
|
|
10409
10412
|
},
|
|
10410
10413
|
weekly: {
|
|
10411
|
-
donator:
|
|
10412
|
-
amount:
|
|
10414
|
+
donator: n["cheer-weekly-top-donator"].name === e,
|
|
10415
|
+
amount: n["cheer-weekly-top-donation"].name === e
|
|
10413
10416
|
},
|
|
10414
10417
|
monthly: {
|
|
10415
|
-
donator:
|
|
10416
|
-
amount:
|
|
10418
|
+
donator: n["cheer-monthly-top-donator"].name === e,
|
|
10419
|
+
amount: n["cheer-monthly-top-donation"].name === e
|
|
10417
10420
|
},
|
|
10418
10421
|
alltime: {
|
|
10419
|
-
donator:
|
|
10420
|
-
amount:
|
|
10422
|
+
donator: n["cheer-alltime-top-donator"].name === e,
|
|
10423
|
+
amount: n["cheer-alltime-top-donation"].name === e
|
|
10421
10424
|
}
|
|
10422
10425
|
},
|
|
10423
10426
|
superchat: {
|
|
10424
10427
|
session: {
|
|
10425
|
-
donator:
|
|
10426
|
-
amount:
|
|
10428
|
+
donator: n["superchat-session-top-donator"].name === e,
|
|
10429
|
+
amount: n["superchat-session-top-donation"].name === e
|
|
10427
10430
|
},
|
|
10428
10431
|
weekly: {
|
|
10429
|
-
donator:
|
|
10430
|
-
amount:
|
|
10432
|
+
donator: n["superchat-weekly-top-donator"].name === e,
|
|
10433
|
+
amount: n["superchat-weekly-top-donation"].name === e
|
|
10431
10434
|
},
|
|
10432
10435
|
monthly: {
|
|
10433
|
-
donator:
|
|
10434
|
-
amount:
|
|
10436
|
+
donator: n["superchat-monthly-top-donator"].name === e,
|
|
10437
|
+
amount: n["superchat-monthly-top-donation"].name === e
|
|
10435
10438
|
},
|
|
10436
10439
|
alltime: {
|
|
10437
|
-
donator:
|
|
10438
|
-
amount:
|
|
10440
|
+
donator: n["superchat-alltime-top-donator"].name === e,
|
|
10441
|
+
amount: n["superchat-alltime-top-donation"].name === e
|
|
10439
10442
|
}
|
|
10440
10443
|
}
|
|
10441
10444
|
});
|
|
10442
|
-
switch (
|
|
10443
|
-
case "twitch":
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
name: e.displayName,
|
|
10471
|
-
role: t,
|
|
10472
|
-
badges: e.badges,
|
|
10473
|
-
top: r(e.displayName)
|
|
10474
|
-
};
|
|
10475
|
-
}
|
|
10476
|
-
}
|
|
10477
|
-
break;
|
|
10445
|
+
switch (e) {
|
|
10446
|
+
case "twitch": {
|
|
10447
|
+
let e = t.event.data, i = await this.findSubscriptionTier({
|
|
10448
|
+
userId: e.userId,
|
|
10449
|
+
name: e.displayName,
|
|
10450
|
+
broadcasterId: e.tags["room-id"]
|
|
10451
|
+
}, n ?? {}, !1);
|
|
10452
|
+
return {
|
|
10453
|
+
id: e.userId,
|
|
10454
|
+
name: e.displayName,
|
|
10455
|
+
color: e.displayColor,
|
|
10456
|
+
role: e.tags.badges.split(",")[0].split("/")[0],
|
|
10457
|
+
tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
|
|
10458
|
+
badges: e.badges,
|
|
10459
|
+
tier: e.tags.badges.includes("subscriber") ? i : void 0,
|
|
10460
|
+
top: r(e.displayName)
|
|
10461
|
+
};
|
|
10462
|
+
}
|
|
10463
|
+
case "youtube": {
|
|
10464
|
+
let e = t.event.data, n = e.authorDetails.isChatOwner ? "broadcaster" : e.authorDetails.isChatModerator ? "moderator" : e.authorDetails.isChatSponsor ? "sponsor" : e.authorDetails.isVerified ? "verified" : "viewer";
|
|
10465
|
+
return {
|
|
10466
|
+
id: e.userId,
|
|
10467
|
+
name: e.displayName,
|
|
10468
|
+
role: n,
|
|
10469
|
+
badges: e.badges,
|
|
10470
|
+
top: r(e.displayName)
|
|
10471
|
+
};
|
|
10472
|
+
}
|
|
10478
10473
|
}
|
|
10479
10474
|
}
|
|
10480
10475
|
}, B;
|