Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vars chore/fix: Hide Deprecated Variables and Update Variable Data Typings #2929

Merged
merged 4 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/variables/builtin/array/array-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
5 changes: 3 additions & 2 deletions src/backend/variables/builtin/array/raw-array-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
4 changes: 2 additions & 2 deletions src/backend/variables/builtin/currency/top-currency-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/backend/variables/builtin/metadata/arg-array-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : [];
Expand Down
4 changes: 2 additions & 2 deletions src/backend/variables/builtin/metadata/top-metadata-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/backend/variables/builtin/misc/quote-as-raw-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/backend/variables/builtin/misc/top-view-time-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const model : ReplaceVariable = {
}
],
categories: [VariableCategory.COMMON, VariableCategory.ADVANCED],
possibleDataOutput: [OutputDataType.TEXT]
possibleDataOutput: [OutputDataType.ARRAY]
},
argsCheck: (
count: null | number = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/backend/variables/builtin/twitch/subs/sub-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const model : ReplaceVariable = {
}
],
categories: [VariableCategory.COMMON, VariableCategory.USER],
possibleDataOutput: [OutputDataType.ALL]
possibleDataOutput: [OutputDataType.ARRAY],
hidden: true
},
evaluator: userRoles.evaluator
};
Expand Down
2 changes: 1 addition & 1 deletion src/backend/variables/builtin/user/roles/user-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown[]> => {
if (username == null && roleType == null) {
Expand Down
3 changes: 2 additions & 1 deletion src/backend/variables/builtin/user/user-id-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
3 changes: 2 additions & 1 deletion src/backend/variables/builtin/user/username-array-raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion src/backend/variables/builtin/user/username-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading