-
Notifications
You must be signed in to change notification settings - Fork 0
Conditions
Source package: com.jopre.streamlink.action.condition
A Condition is a single evaluation check that gates whether an Action (see
Action Items) is allowed to run — for example "does this variable equal a
given string" or "is the chatter subscribed." Each concrete class below extends the
com.jopre.streamlink.action.condition.Condition base class and represents one JSON object.
Multiple conditions can be grouped together with ConditionList (conditions + an
orConditions flag selecting AND vs. OR evaluation across the group).
Enums referenced by these classes are documented separately on the Condition Enums page and linked from the relevant field below.
ConditionItemDeserializer reads the type field of each JSON object, maps it to a
ConditionType constant, and deserializes the object into the matching class listed in the
table below.
type JSON value |
Condition Class |
|---|---|
string-compare |
StringCompareCondition |
integer-numeric-condition |
IntegerNumericCondition |
decimal-numeric-condition |
DecimalNumericCondition |
chat-user-name |
UserNameCondition |
user-subscribe |
UserSubscribeCondition |
boolean-condition |
BooleanCompareCondition |
variable-exists |
VariableExistsCondition |
Note: there is no fallback class here — see the caution under
ConditionTypeon the enums page.
Every Condition below inherits these two fields from the Condition base class, in addition to
whatever fields are listed in its own section.
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
type |
type |
ConditionType |
What type of condition is this object |
variableName |
variableName |
String | The Name of the variable to compare |
Not itself a Condition, but the grouping type used wherever a set of Conditions is attached to an
Action (e.g. Action.conditionList). Lives in the same package,
com.jopre.streamlink.action.condition.
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
conditions |
conditions |
List of Condition
|
The list of conditions to evaluate |
orConditions |
orConditions |
Boolean | If true, at least one condition has to evaulate as true, If False, all conditions have to evaulate to true |
Sample JSON
{
"orConditions": false,
"conditions": [
{
"type": "chat-user-name",
"variableName": "event.user-name",
"userName": "shadowfax"
},
{
"type": "variable-exists",
"variableName": "stream.last-raider",
"checkDoesNotExist": false
}
]
}TODO: description
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
variableValue |
variableValue |
String | The Value or the Variable (in markup notation) to compare to the variable value |
condMethod |
condMethod |
ConditionCompareMethod |
The Type of string comparision |
Sample JSON
{
"type": "string-compare",
"variableName": "event.user-name",
"variableValue": "shadowfax",
"condMethod": "equal"
}TODO: description
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
minVal |
minVal |
Integer | The minimum value for a integer. |
maxVal |
maxVal |
Integer | The maximum value for an integer |
useRange |
useRange |
Boolean | If true. do a range compare. If False, checks for equality |
equalVal |
equalVal |
Integer | If useRange is false then what exact value to look for |
If useRange is true then it will use minVal and maxVal for the compare. You can leave Min or max value out if needed for example, if i wanted to do at least 100 bits min val would be 100 and max val will be null
Sample JSON — range check
{
"type": "integer-numeric-condition",
"variableName": "event.bits",
"minVal": 100,
"maxVal": 500,
"useRange": true
}Sample JSON — equality check
{
"type": "integer-numeric-condition",
"variableName": "event.viewers",
"useRange": false,
"equalVal": 10
}TODO: description
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
minVal |
minVal |
Double | The minimum value for a decimal value. |
maxVal |
maxVal |
Double | The maximum value for an decimal value |
useRange |
useRange |
Boolean | If true. do a range compare. If False, checks for equality |
equalVal |
equalVal |
Double | If useRange is false then what exact value to look for |
If useRange is true then it will use minVal and maxVal for the compare. You can leave Min or max value out if needed for example, if i wanted to do at least 100 bits min val would be 100 and max val will be null
Sample JSON — range check
{
"type": "decimal-numeric-condition",
"variableName": "stream.donation-total",
"minVal": 5.0,
"maxVal": 50.0,
"useRange": true
}Sample JSON — equality check
{
"type": "decimal-numeric-condition",
"variableName": "stream.donation-total",
"useRange": false,
"equalVal": 5.0
}TODO: description
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
userName |
userName |
String | What user name are you looking for |
Sample JSON
{
"type": "chat-user-name",
"variableName": "event.user-name",
"userName": "shadowfax"
}TODO: description
This condition adds no fields beyond the common fields.
Sample JSON
{
"type": "user-subscribe",
"variableName": "event.is-subscriber"
}TODO: description
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
booleanVal |
booleanVal |
Boolean | what value true or false are you comparing to |
Sample JSON
{
"type": "boolean-condition",
"variableName": "stream.hype-train-active",
"booleanVal": true
}TODO: description — new since the last wiki pass; not yet present in the deployed docs.
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
checkDoesNotExist |
checkDoesNotExist |
Boolean | if checkDoesNotExist is true, then check to see if the variable does not exist. if checkDoesNotExist is false then checks to see if a variable exists. |
Sample JSON
{
"type": "variable-exists",
"variableName": "stream.last-raider",
"checkDoesNotExist": false
}TODO: description — Performs different types of variable compares.
| Field | JSON Key | Data Type | Description |
|---|---|---|---|
compareMethod |
compareMethod |
ConditionCompareMethod |
if checkDoesNotExist is true, then check to see if the variable does not exist. if checkDoesNotExist is false then checks to see if a variable exists. |
operand |
operand |
String | The Type of comparison. |
Sample JSON
{
"compareMethod": "greater-equal",
"operand": "#stream-link-xp-goal#",
"variableName": "stream-link-current-xp",
"type": "variable-compare"
}