@tixyel/streamelements 7.0.4 → 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 CHANGED
@@ -2986,7 +2986,7 @@ declare class UtilsHelper {
2986
2986
  userId: string;
2987
2987
  name: string;
2988
2988
  broadcasterId?: string;
2989
- }, session: StreamElements.Session.Data, checkWithAPI?: boolean): Promise<3 | 1 | 2>;
2989
+ }, session: StreamElements.Session.Data, checkWithAPI?: boolean): Promise<1 | 2 | 3>;
2990
2990
  /**
2991
2991
  * Identifies a user based on the received event and session data, returning their ID, name, role, badges, and top status.
2992
2992
  * @param receivedEvent - The event received from the provider (Twitch or YouTube) containing user information.
@@ -3015,7 +3015,8 @@ declare class UtilsHelper {
3015
3015
  * // }
3016
3016
  * ```
3017
3017
  */
3018
- identifyUser(receivedEvent: StreamElements.Event.Provider.Twitch.Message | StreamElements.Event.Provider.YouTube.Message, session: StreamElements.Session.Data): Promise<IdentifyYouTubeResult | IdentifyTwitchResult | undefined>;
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>;
3019
3020
  }
3020
3021
  type TopType = {
3021
3022
  gifter: boolean;
package/dist/index.es.js CHANGED
@@ -10254,11 +10254,7 @@ var M = class {
10254
10254
  continue;
10255
10255
  }
10256
10256
  n.length < c && this.emit("warn", /* @__PURE__ */ Error(`User "${e}" could only receive ${n.length} badge(s), below the configured minimum of ${c}`));
10257
- let i = o.length + 1, a = n.some((e) => [
10258
- "subscriber",
10259
- "prime",
10260
- "founder"
10261
- ].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);
10262
10258
  o.push(s);
10263
10259
  }
10264
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;
@@ -10388,100 +10384,92 @@ var M = class {
10388
10384
  }
10389
10385
  return 1;
10390
10386
  }
10391
- async identifyUser(e, t) {
10392
- let n = new D().parseProvider(e), r = (e) => ({
10393
- gifter: t["subscriber-alltime-gifter"].name === e,
10387
+ async identifyUser(e, t, n) {
10388
+ let r = (e) => ({
10389
+ gifter: n["subscriber-alltime-gifter"].name === e,
10394
10390
  tip: {
10395
10391
  session: {
10396
- donator: t["tip-session-top-donator"].name === e,
10397
- donation: t["tip-session-top-donation"].name === e
10392
+ donator: n["tip-session-top-donator"].name === e,
10393
+ donation: n["tip-session-top-donation"].name === e
10398
10394
  },
10399
10395
  weekly: {
10400
- donator: t["tip-weekly-top-donator"].name === e,
10401
- donation: t["tip-weekly-top-donation"].name === e
10396
+ donator: n["tip-weekly-top-donator"].name === e,
10397
+ donation: n["tip-weekly-top-donation"].name === e
10402
10398
  },
10403
10399
  monthly: {
10404
- donator: t["tip-monthly-top-donator"].name === e,
10405
- donation: t["tip-monthly-top-donation"].name === e
10400
+ donator: n["tip-monthly-top-donator"].name === e,
10401
+ donation: n["tip-monthly-top-donation"].name === e
10406
10402
  },
10407
10403
  alltime: {
10408
- donator: t["tip-alltime-top-donator"].name === e,
10409
- donation: t["tip-alltime-top-donation"].name === e
10404
+ donator: n["tip-alltime-top-donator"].name === e,
10405
+ donation: n["tip-alltime-top-donation"].name === e
10410
10406
  }
10411
10407
  },
10412
10408
  cheer: {
10413
10409
  session: {
10414
- donator: t["cheer-session-top-donator"].name === e,
10415
- amount: t["cheer-session-top-donation"].name === e
10410
+ donator: n["cheer-session-top-donator"].name === e,
10411
+ amount: n["cheer-session-top-donation"].name === e
10416
10412
  },
10417
10413
  weekly: {
10418
- donator: t["cheer-weekly-top-donator"].name === e,
10419
- amount: t["cheer-weekly-top-donation"].name === e
10414
+ donator: n["cheer-weekly-top-donator"].name === e,
10415
+ amount: n["cheer-weekly-top-donation"].name === e
10420
10416
  },
10421
10417
  monthly: {
10422
- donator: t["cheer-monthly-top-donator"].name === e,
10423
- amount: t["cheer-monthly-top-donation"].name === e
10418
+ donator: n["cheer-monthly-top-donator"].name === e,
10419
+ amount: n["cheer-monthly-top-donation"].name === e
10424
10420
  },
10425
10421
  alltime: {
10426
- donator: t["cheer-alltime-top-donator"].name === e,
10427
- amount: t["cheer-alltime-top-donation"].name === e
10422
+ donator: n["cheer-alltime-top-donator"].name === e,
10423
+ amount: n["cheer-alltime-top-donation"].name === e
10428
10424
  }
10429
10425
  },
10430
10426
  superchat: {
10431
10427
  session: {
10432
- donator: t["superchat-session-top-donator"].name === e,
10433
- amount: t["superchat-session-top-donation"].name === e
10428
+ donator: n["superchat-session-top-donator"].name === e,
10429
+ amount: n["superchat-session-top-donation"].name === e
10434
10430
  },
10435
10431
  weekly: {
10436
- donator: t["superchat-weekly-top-donator"].name === e,
10437
- amount: t["superchat-weekly-top-donation"].name === e
10432
+ donator: n["superchat-weekly-top-donator"].name === e,
10433
+ amount: n["superchat-weekly-top-donation"].name === e
10438
10434
  },
10439
10435
  monthly: {
10440
- donator: t["superchat-monthly-top-donator"].name === e,
10441
- amount: t["superchat-monthly-top-donation"].name === e
10436
+ donator: n["superchat-monthly-top-donator"].name === e,
10437
+ amount: n["superchat-monthly-top-donation"].name === e
10442
10438
  },
10443
10439
  alltime: {
10444
- donator: t["superchat-alltime-top-donator"].name === e,
10445
- amount: t["superchat-alltime-top-donation"].name === e
10440
+ donator: n["superchat-alltime-top-donator"].name === e,
10441
+ amount: n["superchat-alltime-top-donation"].name === e
10446
10442
  }
10447
10443
  }
10448
10444
  });
10449
- switch (n.provider) {
10450
- case "twitch":
10451
- switch (n.data.listener) {
10452
- case "message": {
10453
- let e = n.data.event.data, i = await this.findSubscriptionTier({
10454
- userId: e.userId,
10455
- name: e.displayName,
10456
- broadcasterId: e.tags["room-id"]
10457
- }, t ?? {}, !1);
10458
- return {
10459
- id: e.userId,
10460
- name: e.displayName,
10461
- color: e.displayColor,
10462
- role: e.tags.badges.split(",")[0].split("/")[0],
10463
- tags: e.tags.badges.split(",").map((e) => e.split("/")[0]),
10464
- badges: e.badges,
10465
- tier: e.tags.badges.includes("subscriber") ? i : void 0,
10466
- top: r(e.displayName)
10467
- };
10468
- }
10469
- }
10470
- break;
10471
- case "youtube":
10472
- switch (n.data.listener) {
10473
- case "message": {
10474
- let e = n.data.event.data, t = e.authorDetails.isChatOwner ? "broadcaster" : e.authorDetails.isChatModerator ? "moderator" : e.authorDetails.isChatSponsor ? "sponsor" : e.authorDetails.isVerified ? "verified" : "viewer";
10475
- return {
10476
- id: e.userId,
10477
- name: e.displayName,
10478
- role: t,
10479
- badges: e.badges,
10480
- top: r(e.displayName)
10481
- };
10482
- }
10483
- }
10484
- 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
+ }
10485
10473
  }
10486
10474
  }
10487
10475
  }, B;