From d8f0979d5ac16ba69852a04d90505eb50ae09eba Mon Sep 17 00:00:00 2001 From: phroggster Date: Sun, 15 Dec 2024 00:42:45 -0600 Subject: [PATCH 1/2] chore: Hide Deprecated Variables - These were marked deprecated back in January, 2024. - They still function like they had, they just won't show up in the variables list drop-down. - Correct, or better specify, result data typings for deprecated vars: - `$rawBitsLeaderboard` - `$rawCustomRoleUsers` - `$rawTopBitsCheerers` - `$rawUsernameArray` - `$rawUserRoles` - And fix two minor misspellings: - `$rawArrayFilter`: twitch -> which - `$rawBitsLeaderBoard`: $bitsLoaderboard -> $bitsLeaderboard --- src/backend/variables/builtin/array/raw-array-filter.ts | 5 +++-- src/backend/variables/builtin/metadata/arg-array-raw.ts | 3 ++- src/backend/variables/builtin/misc/quote-as-raw-object.ts | 3 ++- .../variables/builtin/twitch/cheer/bits-leaderboard-raw.ts | 5 +++-- .../variables/builtin/twitch/cheer/bits-top-cheerers-raw.ts | 3 ++- .../variables/builtin/user/roles/custom-role-users-raw.ts | 3 ++- src/backend/variables/builtin/user/roles/user-roles-raw.ts | 3 ++- src/backend/variables/builtin/user/user-id-name.ts | 3 ++- src/backend/variables/builtin/user/username-array-raw.ts | 3 ++- 9 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/backend/variables/builtin/array/raw-array-filter.ts b/src/backend/variables/builtin/array/raw-array-filter.ts index 3057070fb..f95a60f61 100644 --- a/src/backend/variables/builtin/array/raw-array-filter.ts +++ b/src/backend/variables/builtin/array/raw-array-filter.ts @@ -19,12 +19,13 @@ const model : ReplaceVariable = { }, { usage: 'rawArrayFilter[rawArray, value, key, true]', - description: 'Filter out any item in the array that has a key property twitch equals "value"' + description: 'Filter out any item in the array that has a key property which equals "value"' } ], categories: [VariableCategory.ADVANCED], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.TEXT], + hidden: true }, evaluator: arrayFilter.evaluator }; diff --git a/src/backend/variables/builtin/metadata/arg-array-raw.ts b/src/backend/variables/builtin/metadata/arg-array-raw.ts index 404b9a3a3..3cb86c08e 100644 --- a/src/backend/variables/builtin/metadata/arg-array-raw.ts +++ b/src/backend/variables/builtin/metadata/arg-array-raw.ts @@ -13,7 +13,8 @@ const model : ReplaceVariable = { description: "(Deprecated: use $argArray) Returns the raw array of command arguments", triggers: triggers, categories: [VariableCategory.ADVANCED], - possibleDataOutput: [OutputDataType.ARRAY] + possibleDataOutput: [OutputDataType.ARRAY], + hidden: true }, evaluator: (trigger: Trigger) : string[] => { return trigger.metadata.userCommand ? trigger.metadata.userCommand.args : []; diff --git a/src/backend/variables/builtin/misc/quote-as-raw-object.ts b/src/backend/variables/builtin/misc/quote-as-raw-object.ts index 90bd13186..35c42de8c 100644 --- a/src/backend/variables/builtin/misc/quote-as-raw-object.ts +++ b/src/backend/variables/builtin/misc/quote-as-raw-object.ts @@ -25,7 +25,8 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.TEXT], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.TEXT], + hidden: true }, evaluator: async (_, quoteId: number, property) => { const quoteCommand = commandManager.getSystemCommandById("firebot:quotesmanagement"); diff --git a/src/backend/variables/builtin/twitch/cheer/bits-leaderboard-raw.ts b/src/backend/variables/builtin/twitch/cheer/bits-leaderboard-raw.ts index f24505d26..63463f945 100644 --- a/src/backend/variables/builtin/twitch/cheer/bits-leaderboard-raw.ts +++ b/src/backend/variables/builtin/twitch/cheer/bits-leaderboard-raw.ts @@ -6,7 +6,7 @@ import bitsLeaderboard from './bits-leaderboard'; const model : ReplaceVariable = { definition: { handle: "rawBitsLeaderboard", - description: "(Deprecated: use $bitsLoaderboard) Returns a raw array of the all-time bits leaderboard of the streamer's channel, up to the specified count. Each item in the array has a `username` and `amount` property", + description: "(Deprecated: use $bitsLeaderboard) Returns a raw array of the all-time bits leaderboard of the streamer's channel, up to the specified count. Each item in the array has a `username` and `amount` property", usage: "rawBitsLeaderboard[count]", examples: [ { @@ -19,7 +19,8 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.COMMON, VariableCategory.ADVANCED], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY], + hidden: true }, evaluator: bitsLeaderboard.evaluator, argsCheck: bitsLeaderboard.argsCheck diff --git a/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers-raw.ts b/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers-raw.ts index 84d2d64a6..99a42e7c6 100644 --- a/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers-raw.ts +++ b/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers-raw.ts @@ -22,7 +22,8 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.COMMON, VariableCategory.USER], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY], + hidden: true }, argsCheck: topBitsCheerers.argsCheck, evaluator: topBitsCheerers.evaluator diff --git a/src/backend/variables/builtin/user/roles/custom-role-users-raw.ts b/src/backend/variables/builtin/user/roles/custom-role-users-raw.ts index e391daf88..299705fef 100644 --- a/src/backend/variables/builtin/user/roles/custom-role-users-raw.ts +++ b/src/backend/variables/builtin/user/roles/custom-role-users-raw.ts @@ -9,7 +9,8 @@ const model : ReplaceVariable = { usage: "rawCustomRoleUsers[role]", description: "(Deprecated: use $customRoleUsers) Returns an array of all the users in the specified custom role.", categories: [VariableCategory.USER], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY], + hidden: true }, evaluator: customRoleUsers.evaluator }; diff --git a/src/backend/variables/builtin/user/roles/user-roles-raw.ts b/src/backend/variables/builtin/user/roles/user-roles-raw.ts index 6efd7565d..8fca9465f 100644 --- a/src/backend/variables/builtin/user/roles/user-roles-raw.ts +++ b/src/backend/variables/builtin/user/roles/user-roles-raw.ts @@ -40,7 +40,8 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.COMMON, VariableCategory.USER], - possibleDataOutput: [OutputDataType.ALL] + possibleDataOutput: [OutputDataType.ARRAY], + hidden: true }, evaluator: userRoles.evaluator }; diff --git a/src/backend/variables/builtin/user/user-id-name.ts b/src/backend/variables/builtin/user/user-id-name.ts index bdbbdae31..1536d3eda 100644 --- a/src/backend/variables/builtin/user/user-id-name.ts +++ b/src/backend/variables/builtin/user/user-id-name.ts @@ -18,7 +18,8 @@ const model : ReplaceVariable = { handle: "useridname", description: "(Deprecated: Use $user or $username) The associated underlying user identifying name for the given trigger.", triggers: triggers, - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.TEXT], + hidden: true }, evaluator: user.evaluator }; diff --git a/src/backend/variables/builtin/user/username-array-raw.ts b/src/backend/variables/builtin/user/username-array-raw.ts index afc2f7961..168d01a88 100644 --- a/src/backend/variables/builtin/user/username-array-raw.ts +++ b/src/backend/variables/builtin/user/username-array-raw.ts @@ -8,7 +8,8 @@ const model : ReplaceVariable = { handle: "rawUsernameArray", description: "(Deprecated: use $usernameArray) Returns a raw array of all usernames saved in the user db", categories: [VariableCategory.ADVANCED], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY], + hidden: true }, evaluator: usernameArray.evaluator }; From d22cd47418d42a20199f7f1254af48662e11d5bf Mon Sep 17 00:00:00 2001 From: phroggster Date: Sun, 15 Dec 2024 01:10:16 -0600 Subject: [PATCH 2/2] fix: Some More Vars Data Typings - Update several variable descriptions to be more consistent, and address a couple of misspellings. - Correct/better-specify result data typings for variables: - `$bitsLeaderboard` - `$rawGiftReceivers` - `$rawTopCurrency` - `$rawTopMetadata` - `$rawTopViewTime` - `$subNames` - `$topBitsCheerers` - `$usernameArray` - `$userRoles` --- src/backend/variables/builtin/array/array-filter.ts | 2 +- src/backend/variables/builtin/currency/top-currency-raw.ts | 4 ++-- src/backend/variables/builtin/metadata/top-metadata-raw.ts | 4 ++-- src/backend/variables/builtin/misc/top-view-time-raw.ts | 4 ++-- .../variables/builtin/twitch/cheer/bits-leaderboard.ts | 2 +- .../variables/builtin/twitch/cheer/bits-top-cheerers.ts | 2 +- .../variables/builtin/twitch/subs/gift-receivers-raw.ts | 2 +- src/backend/variables/builtin/twitch/subs/sub-users.ts | 6 +++--- .../builtin/user/roles/random-custom-role-user-raw.ts | 2 +- src/backend/variables/builtin/user/roles/user-roles.ts | 2 +- src/backend/variables/builtin/user/username-array.ts | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/backend/variables/builtin/array/array-filter.ts b/src/backend/variables/builtin/array/array-filter.ts index 7aaa90494..5e59f4adb 100644 --- a/src/backend/variables/builtin/array/array-filter.ts +++ b/src/backend/variables/builtin/array/array-filter.ts @@ -93,7 +93,7 @@ const model : ReplaceVariable = { }, { usage: 'arrayFilter[rawArray, value, key, true]', - description: 'Filter out any item in the array that has a key property twitch equals "value"' + description: 'Filter out any item in the array that has a key property which equals "value"' } ], categories: [VariableCategory.ADVANCED], diff --git a/src/backend/variables/builtin/currency/top-currency-raw.ts b/src/backend/variables/builtin/currency/top-currency-raw.ts index 4a2194d41..cb037f3e6 100644 --- a/src/backend/variables/builtin/currency/top-currency-raw.ts +++ b/src/backend/variables/builtin/currency/top-currency-raw.ts @@ -7,9 +7,9 @@ import currencyManager from "../../../currency/currency-manager"; const model : ReplaceVariable = { definition: { handle: "rawTopCurrency", - description: "Returns a raw array containing those with the most of the specified currency. Items in the array contain 'place', 'username' and 'amount' properties", + description: "Returns a raw array containing those with the most of the specified currency. Items in the array contain `place`, `username` and `amount` properties.", usage: "rawTopCurrency[currencyName]", - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY] }, // eslint-disable-next-line @typescript-eslint/no-inferrable-types diff --git a/src/backend/variables/builtin/metadata/top-metadata-raw.ts b/src/backend/variables/builtin/metadata/top-metadata-raw.ts index c0db94041..abe4c8286 100644 --- a/src/backend/variables/builtin/metadata/top-metadata-raw.ts +++ b/src/backend/variables/builtin/metadata/top-metadata-raw.ts @@ -6,9 +6,9 @@ import viewerMetadataManager from "../../../viewers/viewer-metadata-manager"; const model : ReplaceVariable = { definition: { handle: "rawTopMetadata", - description: "Returns a raw array of users with the most of a given metadata key. Items contain 'username', 'place' and 'amount' properties", + description: "Returns a raw array of users with the most of a given metadata key. Items contain `username`, `place` and `amount` properties.", usage: "rawTopMetadata[metadataKey]", - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY, OutputDataType.TEXT] }, // eslint-disable-next-line @typescript-eslint/no-inferrable-types diff --git a/src/backend/variables/builtin/misc/top-view-time-raw.ts b/src/backend/variables/builtin/misc/top-view-time-raw.ts index e119376c8..755eef43e 100644 --- a/src/backend/variables/builtin/misc/top-view-time-raw.ts +++ b/src/backend/variables/builtin/misc/top-view-time-raw.ts @@ -6,9 +6,9 @@ import viewerOnlineStatusManager from "../../../viewers/viewer-online-status-man const model : ReplaceVariable = { definition: { handle: "rawTopViewTime", - description: "Returns a raw array containing users with the most view time(in hours). Items contain 'username', 'place' and 'minutes' properties", + description: "Returns a raw array containing users with the most view time (in hours). Items contain `username`, 'place` and `minutes` properties.", usage: "rawTopViewTime[count]", - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY] }, // eslint-disable-next-line @typescript-eslint/no-inferrable-types diff --git a/src/backend/variables/builtin/twitch/cheer/bits-leaderboard.ts b/src/backend/variables/builtin/twitch/cheer/bits-leaderboard.ts index b6f5338fb..d7b8d8b59 100644 --- a/src/backend/variables/builtin/twitch/cheer/bits-leaderboard.ts +++ b/src/backend/variables/builtin/twitch/cheer/bits-leaderboard.ts @@ -23,7 +23,7 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.COMMON, VariableCategory.ADVANCED], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY] }, argsCheck: ( count: null | number = 1, diff --git a/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers.ts b/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers.ts index 82b17ebb4..21e5649ae 100644 --- a/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers.ts +++ b/src/backend/variables/builtin/twitch/cheer/bits-top-cheerers.ts @@ -24,7 +24,7 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.COMMON, VariableCategory.USER], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY] }, argsCheck: (count: null | number = 1, period: null | string = "all", startDate = null) => { if (count == null && period == null && startDate == null) { diff --git a/src/backend/variables/builtin/twitch/subs/gift-receivers-raw.ts b/src/backend/variables/builtin/twitch/subs/gift-receivers-raw.ts index 2ee0a95e9..f3397596b 100644 --- a/src/backend/variables/builtin/twitch/subs/gift-receivers-raw.ts +++ b/src/backend/variables/builtin/twitch/subs/gift-receivers-raw.ts @@ -12,7 +12,7 @@ const model : ReplaceVariable = { description: "Returns a raw array containing the recipients' usernames and months subbed", triggers: triggers, categories: [VariableCategory.COMMON, VariableCategory.USER, VariableCategory.TRIGGER], - possibleDataOutput: [OutputDataType.ALL] + possibleDataOutput: [OutputDataType.ARRAY, OutputDataType.TEXT] }, evaluator: (trigger) => { if (trigger == null || trigger.metadata == null || trigger.metadata.eventData == null || trigger.metadata.eventData.giftReceivers == null) { diff --git a/src/backend/variables/builtin/twitch/subs/sub-users.ts b/src/backend/variables/builtin/twitch/subs/sub-users.ts index 793604d2e..a4821b96b 100644 --- a/src/backend/variables/builtin/twitch/subs/sub-users.ts +++ b/src/backend/variables/builtin/twitch/subs/sub-users.ts @@ -8,15 +8,15 @@ const logger = require("../../../../logwrapper"); const model : ReplaceVariable = { definition: { handle: "subNames", - description: "Returns an array of subscriptions you currently have. Items contain 'username', 'tier' and 'isGift' properties", + description: "Returns an array of subscribers you currently have. Items contain `username`, `tier` and `isGift` properties.", usage: "subNames", examples: [ { usage: "subNames", - description: 'Returns: [{username: "firebottle", displayname: "FireBottle", tier: 2000, isGift:false}, {username: "ebiggz", displayname: "EBiggz", tier: 1000, isGift:true}] To be used with array or custom variables' + description: 'Returns: [{username: "firebottle", displayname: "FireBottle", tier: 2000, isGift:false}, {username: "ebiggz", displayname: "EBiggz", tier: 1000, isGift:true}] To be used with array or custom variables.' } ], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY] }, evaluator: async () => { const { streamer } = accountAccess.getAccounts(); diff --git a/src/backend/variables/builtin/user/roles/random-custom-role-user-raw.ts b/src/backend/variables/builtin/user/roles/random-custom-role-user-raw.ts index de39aad5c..bfafbe80b 100644 --- a/src/backend/variables/builtin/user/roles/random-custom-role-user-raw.ts +++ b/src/backend/variables/builtin/user/roles/random-custom-role-user-raw.ts @@ -8,7 +8,7 @@ const model : ReplaceVariable = { definition: { handle: "rawRandomCustomRoleUser", usage: "rawRandomCustomRoleUser[role]", - description: "Returns a random user that has the specified custom role as an object containing `id`, `username`, and `displayName` fields.", + description: "Returns a random user that has the specified custom role as an object containing `id`, `username`, and `displayName` properties.", categories: [VariableCategory.USER], possibleDataOutput: [OutputDataType.OBJECT] }, diff --git a/src/backend/variables/builtin/user/roles/user-roles.ts b/src/backend/variables/builtin/user/roles/user-roles.ts index d029923f3..7f5510a89 100644 --- a/src/backend/variables/builtin/user/roles/user-roles.ts +++ b/src/backend/variables/builtin/user/roles/user-roles.ts @@ -40,7 +40,7 @@ const model : ReplaceVariable = { } ], categories: [VariableCategory.COMMON, VariableCategory.USER], - possibleDataOutput: [OutputDataType.ALL] + possibleDataOutput: [OutputDataType.ARRAY] }, evaluator: async (trigger, username: null | string, roleType) : Promise => { if (username == null && roleType == null) { diff --git a/src/backend/variables/builtin/user/username-array.ts b/src/backend/variables/builtin/user/username-array.ts index 4f88d9c5e..af6b7ed93 100644 --- a/src/backend/variables/builtin/user/username-array.ts +++ b/src/backend/variables/builtin/user/username-array.ts @@ -8,7 +8,7 @@ const model : ReplaceVariable = { handle: "usernameArray", description: "Returns an array of all usernames saved in the user db", categories: [VariableCategory.ADVANCED], - possibleDataOutput: [OutputDataType.TEXT] + possibleDataOutput: [OutputDataType.ARRAY] }, evaluator: async () => { const usernames = await viewerDatabase.getAllUsernames();