Skip to content

Commit b670436

Browse files
authored
Merge pull request #99 from Kruiser8/develop
Updates for v2.3.0
2 parents dddd188 + 506274d commit b670436

9 files changed

Lines changed: 394 additions & 153 deletions

File tree

js/Documentation.md

Lines changed: 192 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ Each handler provides its own triggers and actions that can be used in a trigger
8080
+ [Discord Title](#discord-title)
8181
+ [Discord Update](#discord-update)
8282
+ [Discord Url](#discord-url)
83+
- [File](#file)
84+
* [Triggers](#file-triggers)
85+
+ [OnFileUpdated](#onfileupdated)
86+
* [Actions](#file-actions)
87+
+ [File Read](#file-read)
8388
- [List](#list)
8489
* [Triggers](#list-triggers)
8590
* [Actions](#list-actions)
@@ -105,6 +110,7 @@ Each handler provides its own triggers and actions that can be used in a trigger
105110
* [Triggers](#miscellaneous-triggers)
106111
+ [OnInit](#oninit)
107112
* [Actions](#miscellaneous-actions)
113+
+ [Args](#args)
108114
+ [AsyncFunction](#asyncfunction)
109115
+ [Delay](#delay)
110116
+ [Error](#error)
@@ -146,6 +152,7 @@ Each handler provides its own triggers and actions that can be used in a trigger
146152
+ [OBS Flip](#obs-flip)
147153
+ [OBS GetCrop](#obs-getcrop)
148154
+ [OBS GetPosition](#obs-getposition)
155+
+ [OBS GetSize](#obs-getsize)
149156
+ [OBS GetSourceTypes](#obs-getsourcetypes)
150157
+ [OBS IsSceneSourceVisible](#obs-isscenesourcevisible)
151158
+ [OBS IsSourceActive](#obs-issourceactive)
@@ -189,6 +196,7 @@ Each handler provides its own triggers and actions that can be used in a trigger
189196
* [Triggers](#param-triggers)
190197
* [Actions](#param-actions)
191198
+ [Param Add](#param-add)
199+
+ [Param Contains](#param-contains)
192200
+ [Param Copy](#param-copy)
193201
+ [Param Create](#param-create)
194202
+ [Param Exists](#param-exists)
@@ -265,11 +273,9 @@ Each handler provides its own triggers and actions that can be used in a trigger
265273
+ [Timer Stop](#timer-stop)
266274
- [Twitch](#twitch)
267275
* [Triggers](#twitch-triggers)
268-
+ [OnTWCommunityGoalComplete](#ontwcommunitygoalcomplete)
269-
+ [OnTWCommunityGoalProgress](#ontwcommunitygoalprogress)
270-
+ [OnTWCommunityGoalStart](#ontwcommunitygoalstart)
271276
+ [OnTWAd](#ontwad)
272277
+ [OnTWBan](#ontwban)
278+
+ [OnTWBits](#ontwbits)
273279
+ [OnTWChannelPoint](#ontwchannelpoint)
274280
+ [OnTWChannelPointCompleted](#ontwchannelpointcompleted)
275281
+ [OnTWChannelPointRejected](#ontwchannelpointrejected)
@@ -281,6 +287,9 @@ Each handler provides its own triggers and actions that can be used in a trigger
281287
+ [OnTWChatClear](#ontwchatclear)
282288
+ [OnTWChatClearUser](#ontwchatclearuser)
283289
+ [OnTWCheer](#ontwcheer)
290+
+ [OnTWCommunityGoalComplete](#ontwcommunitygoalcomplete)
291+
+ [OnTWCommunityGoalProgress](#ontwcommunitygoalprogress)
292+
+ [OnTWCommunityGoalStart](#ontwcommunitygoalstart)
284293
+ [OnTWFollow](#ontwfollow)
285294
+ [OnTWGoalCompleted](#ontwgoalcompleted)
286295
+ [OnTWGoalFailed](#ontwgoalfailed)
@@ -1269,6 +1278,43 @@ None at the moment.
12691278

12701279
***
12711280

1281+
## File
1282+
A small handler to allow you to read files. Files may need to be referenced via relative paths instead of absolute paths. That is, use `example.txt`, `folder/example.txt`, or `../folder/example.txt` instead of `C:/Users/PC/Documents/folder/example.txt`.
1283+
1284+
As a best practice, wrap file paths in quotation marks. Example: `"folder/example.txt"`.
1285+
1286+
### File Triggers
1287+
1288+
#### OnFileUpdated
1289+
| | |
1290+
------------ | -------------
1291+
**Info** | Triggers when a file updates. `<file>` indicates the name of the file to check for updates.
1292+
**Format** | `OnFileUpdated <file>`
1293+
**Example** | `OnFileUpdated "users/champion.txt"`
1294+
1295+
##### Parameters
1296+
| | |
1297+
------------ | -------------
1298+
**content** | The text content of the updated file.
1299+
1300+
***
1301+
1302+
### File Actions
1303+
1304+
#### File Read
1305+
| | |
1306+
------------ | -------------
1307+
**Info** | Reads a file locally. `<file>` indicates the name of the file to read.
1308+
**Format** | `File Read <file>`
1309+
**Example** | `File Read "users/champion.txt"`
1310+
1311+
##### Parameters
1312+
| | |
1313+
------------ | -------------
1314+
**content** | The text content of the file.
1315+
1316+
***
1317+
12721318
## List
12731319
A small handler to allow you to store and update lists of items.
12741320

@@ -1450,7 +1496,7 @@ _Note: The above example, `List Export MyList`, would return the parameter **MyL
14501496
#### List Unique
14511497
| | |
14521498
------------ | -------------
1453-
**Info** | Remove any duplicates from the list. `<list>` is the name of the list to update.
1499+
**Info** | Remove any duplicates from the list. `<list>` is the name of the list to update.
14541500
**Format** | `List Unique <list>`
14551501
**Example** | `List Unique MyList`
14561502

@@ -1505,6 +1551,41 @@ A small selection of actions that are included for increased usability.
15051551

15061552
### Miscellaneous Actions
15071553

1554+
#### Args
1555+
| | |
1556+
------------ | -------------
1557+
**Info** | Used to parse a given input into the specified named args (or parameters).
1558+
**Format** | `Args <value> <arg>`
1559+
**Format w/ Aliases** | `Args <value> <arg1> <arg2> <arg3>`
1560+
**Example w/ Multiple Args** | `Args "FirstItem SecondItem" <item1> <item2>`
1561+
1562+
##### Parameters
1563+
| | |
1564+
------------ | -------------
1565+
**\<arg\>** | Returns a value for each `<arg>` value specified.
1566+
1567+
##### Example Usage
1568+
1569+
<table>
1570+
<tr>
1571+
<td>Parses the input to a command for a specified scene and source to hide.</td>
1572+
</tr>
1573+
<tr>
1574+
<td>
1575+
1576+
```m
1577+
# Example Usage: !hide Game GameSource
1578+
OnCommand b 0 !hide
1579+
Args {after} {scene} {source}
1580+
OBS SceneSource {scene} {source} off
1581+
```
1582+
1583+
</td>
1584+
</tr>
1585+
</table>
1586+
1587+
***
1588+
15081589
#### AsyncFunction
15091590
`AsyncFunction` is an alternate to [`Function`](#function) that allows you to call javascript code using the `await` keyword. This is for advanced use cases that require API calls, promises, etc. For more information, please see this [documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction).
15101591

@@ -2031,6 +2112,21 @@ y | The y position of the source
20312112

20322113
***
20332114

2115+
#### OBS GetSize
2116+
| | |
2117+
------------ | -------------
2118+
**Info** | Gets the size for a source in a given scene in OBS. `<scene>` is the scene the source is in. `<source>` is the source to get the size for.
2119+
**Format** | `OBS GetSize <scene> <source>`
2120+
**Example** | `OBS GetSize Webcam Camera`
2121+
2122+
##### Parameters
2123+
| | |
2124+
------------ | -------------
2125+
width | The width of the source
2126+
height | The height of the source
2127+
2128+
***
2129+
20342130
#### OBS GetSourceTypes
20352131
| | |
20362132
------------ | -------------
@@ -2537,6 +2633,20 @@ None at the moment.
25372633

25382634
***
25392635

2636+
#### Param Contains
2637+
| | |
2638+
------------ | -------------
2639+
**Info** | Checks if the specified text exists within a parameter. `<parameter>` is the name of the existing parameter. `<value>` is the value to look for in the parameter. `Param Contains` differs from `Param Keyword` as it is case sensitive and does not require whitespace around the searched text
2640+
**Format** | `Param Contains <parameter> <value>`
2641+
**Example** | `Param Contains after "app"`
2642+
2643+
##### Parameters
2644+
| | |
2645+
------------ | -------------
2646+
**contains** | [true/false] Whether or not the value was found in the parameter.
2647+
2648+
***
2649+
25402650
#### Param Copy
25412651
| | |
25422652
------------ | -------------
@@ -3358,65 +3468,6 @@ Enables the ability to run actions when channel point rewards are redeemed.
33583468

33593469
### Twitch Triggers
33603470

3361-
#### OnCommunityGoalComplete
3362-
| | |
3363-
------------ | -------------
3364-
**Info** | Used to trigger a set of actions when a community goal is completed. Using `*` as the `<goal_title>` will execute the trigger for all channel point rewards.
3365-
**Format** | `OnCommunityGoalComplete <goal_title>`
3366-
**Format w/ Aliases** | `OnCommunityGoalComplete <goal_title1> <goal_title2> ...`
3367-
**Example** | `OnCommunityGoalComplete "Example Goal"`
3368-
**Example w/ Aliases** | `OnCommunityGoalComplete "Example Goal" "Extra Sunday Stream" ...`
3369-
3370-
##### Parameters
3371-
| | |
3372-
------------ | -------------
3373-
**goal** | The title of the community goal.
3374-
**user** | The display name of the user that completed the goal.
3375-
**amount** | The amount of points donated to complete the goal.
3376-
**user_total** | The total amount of points contributed by the user.
3377-
**progress** | The current amount of points contributed towards the goal.
3378-
**total** | The amount of points required to complete the goal.
3379-
**data** | The complete json community goal message (for use with [Function](#function)).
3380-
3381-
#### OnCommunityGoalProgress
3382-
| | |
3383-
------------ | -------------
3384-
**Info** | Used to trigger a set of actions when a user contributes towards a goal. Using `*` as the `<goal_title>` will execute the trigger for all channel point rewards.
3385-
**Format** | `OnCommunityGoalProgress <goal_title>`
3386-
**Format w/ Aliases** | `OnCommunityGoalProgress <goal_title1> <goal_title2> ...`
3387-
**Example** | `OnCommunityGoalProgress "Example Goal"`
3388-
**Example w/ Aliases** | `OnCommunityGoalProgress "Example Goal" "Extra Sunday Stream" ...`
3389-
3390-
##### Parameters
3391-
| | |
3392-
------------ | -------------
3393-
**goal** | The title of the community goal.
3394-
**user** | The display name of the user that completed the goal.
3395-
**amount** | The amount of points donated to complete the goal.
3396-
**user_total** | The total amount of points contributed by the user.
3397-
**progress** | The current amount of points contributed towards the goal.
3398-
**total** | The amount of points required to complete the goal.
3399-
**data** | The complete json community goal message (for use with [Function](#function)).
3400-
3401-
***
3402-
3403-
#### OnCommunityGoalStart
3404-
| | |
3405-
------------ | -------------
3406-
**Info** | Used to trigger a set of actions when the streamer starts a goal. Using `*` as the `<goal_title>` will execute the trigger for all channel point rewards.
3407-
**Format** | `OnCommunityGoalStart <goal_title>`
3408-
**Format w/ Aliases** | `OnCommunityGoalStart <goal_title1> <goal_title2> ...`
3409-
**Example** | `OnCommunityGoalStart "Example Goal"`
3410-
**Example w/ Aliases** | `OnCommunityGoalStart "Example Goal" "Extra Sunday Stream" ...`
3411-
3412-
##### Parameters
3413-
| | |
3414-
------------ | -------------
3415-
**goal** | The title of the community goal.
3416-
**data** | The complete json community goal message (for use with [Function](#function)).
3417-
3418-
***
3419-
34203471
#### OnTWAd
34213472
| | |
34223473
------------ | -------------
@@ -3452,6 +3503,25 @@ Enables the ability to run actions when channel point rewards are redeemed.
34523503

34533504
***
34543505

3506+
#### OnTWBits
3507+
| | |
3508+
------------ | -------------
3509+
**Info** | Triggers when bits are used in the channel. Triggers for cheers, power-ups, and combos.
3510+
**Format** | `OnTWBits`
3511+
**Example** | `OnTWBits`
3512+
3513+
##### Parameters
3514+
| | |
3515+
------------ | -------------
3516+
**id** | The user ID of the user using bits.
3517+
**login** | The user login of the user using bits.
3518+
**name** | The user display name of the user using bits.
3519+
**data** | The complete Twitch EventSub event data (for use with [Function](#function)).
3520+
**amount** | The amount of bits cheered by the user.
3521+
**message** | The message included with the bits. This will be an empty string if no message is included.
3522+
3523+
***
3524+
34553525
#### OnTWChannelPoint
34563526
| | |
34573527
------------ | -------------
@@ -3667,6 +3737,65 @@ Enables the ability to run actions when channel point rewards are redeemed.
36673737

36683738
***
36693739

3740+
#### OnTWCommunityGoalComplete
3741+
| | |
3742+
------------ | -------------
3743+
**Info** | Used to trigger a set of actions when a community goal is completed. Using `*` as the `<goal_title>` will execute the trigger for all channel point rewards.
3744+
**Format** | `OnTWCommunityGoalComplete <goal_title>`
3745+
**Format w/ Aliases** | `OnTWCommunityGoalComplete <goal_title1> <goal_title2> ...`
3746+
**Example** | `OnTWCommunityGoalComplete "Example Goal"`
3747+
**Example w/ Aliases** | `OnTWCommunityGoalComplete "Example Goal" "Extra Sunday Stream" ...`
3748+
3749+
##### Parameters
3750+
| | |
3751+
------------ | -------------
3752+
**goal** | The title of the community goal.
3753+
**user** | The display name of the user that completed the goal.
3754+
**amount** | The amount of points donated to complete the goal.
3755+
**user_total** | The total amount of points contributed by the user.
3756+
**progress** | The current amount of points contributed towards the goal.
3757+
**total** | The amount of points required to complete the goal.
3758+
**data** | The complete json community goal message (for use with [Function](#function)).
3759+
3760+
#### OnTWCommunityGoalProgress
3761+
| | |
3762+
------------ | -------------
3763+
**Info** | Used to trigger a set of actions when a user contributes towards a goal. Using `*` as the `<goal_title>` will execute the trigger for all channel point rewards.
3764+
**Format** | `OnTWCommunityGoalProgress <goal_title>`
3765+
**Format w/ Aliases** | `OnTWCommunityGoalProgress <goal_title1> <goal_title2> ...`
3766+
**Example** | `OnTWCommunityGoalProgress "Example Goal"`
3767+
**Example w/ Aliases** | `OnTWCommunityGoalProgress "Example Goal" "Extra Sunday Stream" ...`
3768+
3769+
##### Parameters
3770+
| | |
3771+
------------ | -------------
3772+
**goal** | The title of the community goal.
3773+
**user** | The display name of the user that completed the goal.
3774+
**amount** | The amount of points donated to complete the goal.
3775+
**user_total** | The total amount of points contributed by the user.
3776+
**progress** | The current amount of points contributed towards the goal.
3777+
**total** | The amount of points required to complete the goal.
3778+
**data** | The complete json community goal message (for use with [Function](#function)).
3779+
3780+
***
3781+
3782+
#### OnTWCommunityGoalStart
3783+
| | |
3784+
------------ | -------------
3785+
**Info** | Used to trigger a set of actions when the streamer starts a goal. Using `*` as the `<goal_title>` will execute the trigger for all channel point rewards.
3786+
**Format** | `OnTWCommunityGoalStart <goal_title>`
3787+
**Format w/ Aliases** | `OnTWCommunityGoalStart <goal_title1> <goal_title2> ...`
3788+
**Example** | `OnTWCommunityGoalStart "Example Goal"`
3789+
**Example w/ Aliases** | `OnTWCommunityGoalStart "Example Goal" "Extra Sunday Stream" ...`
3790+
3791+
##### Parameters
3792+
| | |
3793+
------------ | -------------
3794+
**goal** | The title of the community goal.
3795+
**data** | The complete json community goal message (for use with [Function](#function)).
3796+
3797+
***
3798+
36703799
#### OnTWFollow
36713800
| | |
36723801
------------ | -------------

js/controller.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ class Controller {
464464
var parser = this.getParser("list");
465465
parser.createList(name, keys);
466466
}
467+
else if (parserName === 'args') {
468+
var { value, args } = Parser.getInputs(data, ['value', 'args'], true);
469+
var valueArgs = Parser.getInputs([null, ...Parser.splitLine(value)], args);
470+
console.error(JSON.stringify(valueArgs));
471+
return valueArgs;
472+
}
467473
else {
468474
// Get parser and run trigger content
469475
var parser = this.getParser(parserName);

0 commit comments

Comments
 (0)