Skip to content

Commit

Permalink
feat: variable examples and description changes (#2908)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Bigler <erikbigler@gmail.com>
  • Loading branch information
CKY- and ebiggz authored Nov 28, 2024
1 parent a003614 commit c5e93ae
Show file tree
Hide file tree
Showing 88 changed files with 373 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ExtraLifeDonations: ReplaceVariable = {
description: "Returns top 3 donations for current signed in extra life account in JSON format."
}
],
categories: [VariableCategory.COMMON, VariableCategory.TRIGGER],
categories: [VariableCategory.COMMON, VariableCategory.INTEGRATION],
possibleDataOutput: [OutputDataType.TEXT]
},
evaluator: (_, sortName: string, numResults: number, participantID: number, returnJson: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ExtraLifeIncentives: ReplaceVariable = {
description: "Returns ten incentives for current logged in extra life account in JSON format."
}
],
categories: [VariableCategory.COMMON, VariableCategory.TRIGGER],
categories: [VariableCategory.COMMON, VariableCategory.INTEGRATION],
possibleDataOutput: [OutputDataType.TEXT]
},
evaluator: async (_, rewardDesc: string, numResults: number, participantID: number, returnJson: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const ExtraLifeInfo: ReplaceVariable = {
description: "Get all profile data for the current logged in extra life account in JSON format."
}
],
categories: [VariableCategory.COMMON, VariableCategory.TRIGGER],
categories: [VariableCategory.COMMON, VariableCategory.INTEGRATION],
possibleDataOutput: [OutputDataType.TEXT]
},
evaluator: (_, infoPath: string, participantID: number, returnJson: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ExtraLifeMilestones: ReplaceVariable = {
description: "Returns three milestones in JSON format."
}
],
categories: [VariableCategory.COMMON, VariableCategory.TRIGGER],
categories: [VariableCategory.COMMON, VariableCategory.INTEGRATION],
possibleDataOutput: [OutputDataType.TEXT]
},
evaluator: async (_, milestoneGoal: string, numResults: number, participantID: number, returnJson: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TriggerType } from "../../../../common/EffectType";
import { ReplaceVariable } from "../../../../../types/variables";
import { OBS_EVENT_SOURCE_ID, OBS_SCENE_ITEM_ENABLE_STATE_CHANGED_EVENT_ID } from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -14,6 +15,7 @@ export const GroupItemIdVariable: ReplaceVariable = {
description:
"The group-unique numeric ID of the item in OBS that triggered the event, or -1 when the item is not grouped.",
possibleDataOutput: ["number"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS],
triggers: triggers
},
evaluator: async (trigger) => {
Expand Down
2 changes: 2 additions & 0 deletions src/backend/integrations/builtin/obs/variables/group-name.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TriggerType } from "../../../../common/EffectType";
import { ReplaceVariable } from "../../../../../types/variables";
import { OBS_EVENT_SOURCE_ID, OBS_SCENE_ITEM_ENABLE_STATE_CHANGED_EVENT_ID } from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -14,6 +15,7 @@ export const GroupNameVariable: ReplaceVariable = {
description:
"The name of the OBS group containing the item that triggered the event, or 'Unknown' if the element isn't grouped.",
possibleDataOutput: ["text"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS],
triggers: triggers
},
evaluator: async (trigger) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_ACTIVE_STATE_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputActiveVariable: ReplaceVariable = {
definition: {
handle: "obsInputActive",
description: "Returns `true` if the OBS input is active or `false` if it is not.",
possibleDataOutput: ["bool"]
possibleDataOutput: ["bool"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputActive = trigger.metadata?.eventData?.inputActive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_AUDIO_BALANCE_CHANGED_EVENT_ID
} from "../constants";

import { VariableCategory } from "../../../../../shared/variable-constants";
const triggers = {};
triggers[TriggerType.EVENT] = [
`${OBS_EVENT_SOURCE_ID}:${OBS_INPUT_AUDIO_BALANCE_CHANGED_EVENT_ID}`
Expand All @@ -15,7 +15,8 @@ export const InputAudioBalanceVariable: ReplaceVariable = {
definition: {
handle: "obsInputAudioBalance",
description: "Returns the audio balance value of the OBS input.",
possibleDataOutput: ["number"]
possibleDataOutput: ["number"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputAudioBalance = trigger.metadata?.eventData?.inputAudioBalance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_AUDIO_MONITOR_TYPE_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputAudioMonitorTypeVariable: ReplaceVariable = {
definition: {
handle: "obsInputMonitorType",
description: "Returns the audio monitor type of the OBS input. Values are `None`, `Monitor Only`, or `Monitor and Output`.",
possibleDataOutput: ["text"]
possibleDataOutput: ["text"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const monitorType = trigger.metadata?.eventData?.monitorType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_AUDIO_BALANCE_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputAudioSyncOffsetVariable: ReplaceVariable = {
definition: {
handle: "obsInputAudioSyncOffset",
description: "Returns the audio sync offset (in milliseconds) of the OBS input.",
possibleDataOutput: ["number"]
possibleDataOutput: ["number"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputAudioSyncOffset = trigger.metadata?.eventData?.inputAudioSyncOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_AUDIO_TRACKS_CHANGED_EVENT_ID
} from "../constants";

import { VariableCategory } from "../../../../../shared/variable-constants";
const triggers = {};
triggers[TriggerType.EVENT] = [
`${OBS_EVENT_SOURCE_ID}:${OBS_INPUT_AUDIO_TRACKS_CHANGED_EVENT_ID}`
Expand All @@ -15,7 +15,8 @@ export const InputAudioTracksVariable: ReplaceVariable = {
definition: {
handle: "obsInputAudioTracks",
description: "Returns the raw OBS audio tracks object of the OBS input.",
possibleDataOutput: ["object"]
possibleDataOutput: ["object"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputAudioTracks = trigger.metadata?.eventData?.inputAudioTracks;
Expand Down
4 changes: 3 additions & 1 deletion src/backend/integrations/builtin/obs/variables/input-kind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_CREATED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputKindVariable: ReplaceVariable = {
definition: {
handle: "obsInputKind",
description: "Returns the OBS internal name of the kind of OBS input.",
possibleDataOutput: ["text"]
possibleDataOutput: ["text"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputKind = trigger.metadata?.eventData?.inputKind;
Expand Down
5 changes: 3 additions & 2 deletions src/backend/integrations/builtin/obs/variables/input-muted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_MUTE_STATE_CHANGED_EVENT_ID
} from "../constants";

import { VariableCategory } from "../../../../../shared/variable-constants";
const triggers = {};
triggers[TriggerType.EVENT] = [
`${OBS_EVENT_SOURCE_ID}:${OBS_INPUT_MUTE_STATE_CHANGED_EVENT_ID}`
Expand All @@ -15,7 +15,8 @@ export const InputMutedVariable: ReplaceVariable = {
definition: {
handle: "obsInputMuted",
description: "Returns `true` if the OBS input is muted or `false` if it is not.",
possibleDataOutput: ["bool"]
possibleDataOutput: ["bool"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputMuted = trigger.metadata?.eventData?.inputMuted;
Expand Down
4 changes: 3 additions & 1 deletion src/backend/integrations/builtin/obs/variables/input-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
OBS_INPUT_AUDIO_MONITOR_TYPE_CHANGED_EVENT_ID,
OBS_INPUT_AUDIO_TRACKS_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -37,7 +38,8 @@ export const InputNameVariable: ReplaceVariable = {
definition: {
handle: "obsInputName",
description: "Returns the name of the OBS input.",
possibleDataOutput: ["text"]
possibleDataOutput: ["text"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputName = trigger.metadata?.eventData?.inputName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
OBS_INPUT_CREATED_EVENT_ID,
OBS_INPUT_SETTINGS_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -17,7 +18,8 @@ export const InputSettingsVariable: ReplaceVariable = {
definition: {
handle: "obsInputSettings",
description: "Returns the raw OBS settings object of the OBS input.",
possibleDataOutput: ["object"]
possibleDataOutput: ["object"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputSettings = trigger.metadata?.eventData?.inputSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_SHOW_STATE_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputShowingVariable: ReplaceVariable = {
definition: {
handle: "obsInputShowing",
description: "Returns `true` if the OBS input is currently showing or `false` if it is not.",
possibleDataOutput: ["bool"]
possibleDataOutput: ["bool"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputShowing = trigger.metadata?.eventData?.inputShowing;
Expand Down
4 changes: 3 additions & 1 deletion src/backend/integrations/builtin/obs/variables/input-uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
OBS_INPUT_AUDIO_MONITOR_TYPE_CHANGED_EVENT_ID,
OBS_INPUT_AUDIO_TRACKS_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -37,7 +38,8 @@ export const InputUuidVariable: ReplaceVariable = {
definition: {
handle: "obsInputUuid",
description: "Returns the UUID of the OBS input.",
possibleDataOutput: ["text"]
possibleDataOutput: ["text"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputUuid = trigger.metadata?.eventData?.inputUuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_VOLUME_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputVolumeDbVariable: ReplaceVariable = {
definition: {
handle: "obsInputVolumeDb",
description: "Returns the volume level in dB of the OBS input.",
possibleDataOutput: ["number"]
possibleDataOutput: ["number"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputVolumeDb = trigger.metadata?.eventData?.inputVolumeDb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_VOLUME_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,7 +16,8 @@ export const InputVolumeMultiplierVariable: ReplaceVariable = {
definition: {
handle: "obsInputVolumeMultiplier",
description: "Returns the volume level multiplier of the OBS input.",
possibleDataOutput: ["number"]
possibleDataOutput: ["number"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async (trigger) => {
const inputVolumeMultiplier = trigger.metadata?.eventData?.inputVolumeMultiplier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ReplaceVariable } from "../../../../../types/variables";
import { isConnected } from "../obs-remote";
import { VariableCategory } from "../../../../../shared/variable-constants";

export const IsConnectedVariable: ReplaceVariable = {
definition: {
handle: "obsIsConnected",
description: "Returns 'true' if OBS is currently connected or 'false' if it is not.",
possibleDataOutput: ["bool"]
possibleDataOutput: ["bool"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async () => {
return isConnected() ?? false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { ReplaceVariable } from "../../../../../types/variables";
import { isRecording } from "../obs-remote";
import { VariableCategory } from "../../../../../shared/variable-constants";

export const IsRecordingVariable: ReplaceVariable = {
definition: {
handle: "obsIsRecording",
description:
"Returns 'true' if OBS is currently recording or 'false' if it is not.",
possibleDataOutput: ["bool"]
possibleDataOutput: ["bool"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async () => {
const recordState = await isRecording();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { ReplaceVariable } from "../../../../../types/variables";
import { isStreaming } from "../obs-remote";
import { VariableCategory } from "../../../../../shared/variable-constants";

export const IsStreamingVariable: ReplaceVariable = {
definition: {
handle: "obsIsStreaming",
description:
"Returns 'true' if OBS is currently streaming or 'false' if it is not.",
possibleDataOutput: ["bool"]
possibleDataOutput: ["bool"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS]
},
evaluator: async () => {
const streamState = await isStreaming();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ColorValueVariable: ReplaceVariable = {
definition: {
handle: "obsColorValue",
description: "Returns an OBS color value based on either a hex color code (e.g. #0066FF) or an HTML color name.",
categories: [VariableCategory.ADVANCED],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS],
possibleDataOutput: ["number"]
},
evaluator: (_, ...args: string[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_EVENT_SOURCE_ID,
OBS_INPUT_NAME_CHANGED_EVENT_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -15,6 +16,7 @@ export const OldInputNameVariable: ReplaceVariable = {
definition: {
handle: "obsOldInputName",
description: "Returns the previous name of the OBS input.",
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS],
possibleDataOutput: ["text"]
},
evaluator: async (trigger) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OBS_CURRENT_PROFILE_CHANGED_EVENT_ID,
OBS_EVENT_SOURCE_ID
} from "../constants";
import { VariableCategory } from "../../../../../shared/variable-constants";

const triggers = {};
triggers[TriggerType.EVENT] = [
Expand All @@ -16,6 +17,7 @@ export const ProfileNameVariable: ReplaceVariable = {
description:
"The name of the OBS profile that triggered the event.",
possibleDataOutput: ["text"],
categories: [VariableCategory.ADVANCED, VariableCategory.INTEGRATION, VariableCategory.OBS],
triggers: triggers
},
evaluator: async (trigger) => {
Expand Down
Loading

0 comments on commit c5e93ae

Please sign in to comment.