@lumiastream/lumia-types 3.2.4 → 3.2.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.
@@ -13,6 +13,32 @@ title: Important notes
13
13
  The different options are: `isSelf, mod, vip, tier3, tier2, tier1, subscriber, follower`.
14
14
  In your code you should use `const levels = await getVariable('userLevelsRaw');` and then you can check a level with `if (levels.subscriber) {}` since these are all booleans
15
15
 
16
+ - We also expose `{{originType}}` so your custom code can tell where the activity came from. Use `const originType = await getVariable('originType');` when you need to branch between alerts and command-based triggers.
17
+ Common values are: `alert`, `chat`, `chatbot`, `twitch-points`, `twitch-extension`, `kick-points`, `system`, and `api`.
18
+ Important: "commands" are not a single origin type. If you want to run only for command-style triggers you will usually want to check for a list like `chat`, `chatbot`, `twitch-points`, `twitch-extension`, and `kick-points`.
19
+
20
+ ```js
21
+ async function() {
22
+ const originType = await getVariable('originType');
23
+ const commandOrigins = ['chat', 'chatbot', 'twitch-points', 'twitch-extension', 'kick-points'];
24
+
25
+ if (originType === 'alert') {
26
+ chatbot({ message: 'This custom code was triggered by an alert.' });
27
+ done();
28
+ return;
29
+ }
30
+
31
+ if (commandOrigins.includes(originType)) {
32
+ chatbot({ message: `Command trigger detected from ${originType}.` });
33
+ done();
34
+ return;
35
+ }
36
+
37
+ log(`Skipping custom code for originType: ${originType}`);
38
+ done();
39
+ }
40
+ ```
41
+
16
42
  - To quickly log out information for easier debugging, use `log("")`. You can also use `console.log` which will do the same thing. This will popup a toast message with what you are trying to log as well as add it to the logs in the dashboard
17
43
 
18
44
  - Everything ran is in a safe JavaScript worker thread away from the Lumia Stream thread so no need to worry about scripts slowing down the app. Make sure you do avoid memory leaks by calling `done()` when you're done with your script
@@ -8,6 +8,8 @@ import { LumiaAlertValues } from './custom-overlays';
8
8
 
9
9
  /** Known platforms (extendable). */
10
10
  type Platform = 'twitch' | 'youtube' | 'kick' | 'tiktok' | 'facebook' | string;
11
+ /** Known Lumia activity origins (extendable). */
12
+ type ActivityOrigin = 'system' | 'alert' | 'chat' | 'chatbot' | 'twitch-points' | 'twitch-extension' | 'kick-points' | 'api' | 'lumiastreamlink' | 'streamdeck' | 'touchportal' | 'avermedia' | 'loupedeck' | string;
11
13
 
12
14
  /** ISO-8601 timestamp branding for better editor hints. */
13
15
  type ISODateString = string & { __iso8601: true };
@@ -27,6 +29,8 @@ type Timing = { checkTimingType: false } | { checkTimingType: true; timingType:
27
29
  interface CommonExtras {
28
30
  /** Origin site/platform for this alert (e.g., "twitch"). */
29
31
  site: Platform;
32
+ /** Lumia queue/activity origin type (e.g., "alert", "chat", "chatbot", "system"). */
33
+ originType?: ActivityOrigin;
30
34
  /** ISO-8601 timestamp when the alert originated. */
31
35
  timestamp: ISODateString;
32
36
 
@@ -127,6 +127,8 @@ export interface AlertEvent {
127
127
  timestamp: string;
128
128
  /** Platform where the alert originated */
129
129
  site: 'twitch' | 'kick' | 'youtube' | 'tiktok' | 'facebook' | string;
130
+ /** Lumia queue/activity origin type (e.g., "alert", "chat", "chatbot", "system") */
131
+ originType?: 'system' | 'alert' | 'chat' | 'chatbot' | 'twitch-points' | 'twitch-extension' | 'kick-points' | 'api' | 'lumiastreamlink' | 'streamdeck' | 'touchportal' | 'avermedia' | 'loupedeck' | string;
130
132
  /** Whether timing type should be checked */
131
133
  checkTimingType: boolean;
132
134
  /** Type of timing for the alert */
@@ -127,6 +127,8 @@ export interface AlertEvent {
127
127
  timestamp: string;
128
128
  /** Platform where the alert originated */
129
129
  site: 'twitch' | 'kick' | 'youtube' | 'tiktok' | 'facebook' | string;
130
+ /** Lumia queue/activity origin type (e.g., "alert", "chat", "chatbot", "system") */
131
+ originType?: 'system' | 'alert' | 'chat' | 'chatbot' | 'twitch-points' | 'twitch-extension' | 'kick-points' | 'api' | 'lumiastreamlink' | 'streamdeck' | 'touchportal' | 'avermedia' | 'loupedeck' | string;
130
132
  /** Whether timing type should be checked */
131
133
  checkTimingType: boolean;
132
134
  /** Type of timing for the alert */
@@ -1,4 +1,4 @@
1
- import { LumiaActivityCommandTypes } from './activity.types';
1
+ import { LumiaActivityCommandTypes, LumiaActivityOriginTypes } from './activity.types';
2
2
  export interface ILumiaSendPack {
3
3
  type: LumiaActivityCommandTypes;
4
4
  params?: {
@@ -19,6 +19,7 @@ export interface ILumiaSendPack {
19
19
  extraSettings?: {
20
20
  username?: string;
21
21
  bits?: number;
22
+ originType?: LumiaActivityOriginTypes;
22
23
  };
23
24
  };
24
25
  }
@@ -723,6 +723,7 @@ exports.ReservedVariables = [
723
723
  'userId',
724
724
  'value',
725
725
  'site',
726
+ 'originType',
726
727
  'command',
727
728
  'merch',
728
729
  'message',
@@ -940,6 +941,7 @@ exports.AllVariables = {
940
941
  'userLevelsRaw',
941
942
  'channelDescription',
942
943
  'channelViews',
944
+ 'originType',
943
945
  'command',
944
946
  'message',
945
947
  'messageId',
@@ -964,6 +966,7 @@ exports.AllVariables = {
964
966
  'userLevelsRaw',
965
967
  'channelDescription',
966
968
  'channelViews',
969
+ 'originType',
967
970
  'command',
968
971
  'message',
969
972
  'messageId',
@@ -984,6 +987,7 @@ exports.AllVariables = {
984
987
  'avatar',
985
988
  'channelDescription',
986
989
  'channelViews',
990
+ 'originType',
987
991
  'command',
988
992
  'prompt',
989
993
  'message',
@@ -1000,6 +1004,7 @@ exports.AllVariables = {
1000
1004
  'avatar',
1001
1005
  'channelDescription',
1002
1006
  'channelViews',
1007
+ 'originType',
1003
1008
  'command',
1004
1009
  'prompt',
1005
1010
  'message',
@@ -1016,6 +1021,7 @@ exports.AllVariables = {
1016
1021
  'avatar',
1017
1022
  'channelDescription',
1018
1023
  'channelViews',
1024
+ 'originType',
1019
1025
  'command',
1020
1026
  'prompt',
1021
1027
  'message',
@@ -1038,6 +1044,7 @@ exports.AllVariables = {
1038
1044
  'userLevelsRaw',
1039
1045
  'channelDescription',
1040
1046
  'channelViews',
1047
+ 'originType',
1041
1048
  'command',
1042
1049
  'message',
1043
1050
  'messageId',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/lumia-types",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "files": [