-
-
Notifications
You must be signed in to change notification settings - Fork 125
Feat: Add $effectQueueLength variable #2533
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
29fb64c
feat: add variable $effectQueueLength to fetch effect queue length
codehdn e60e546
refactor: updating placeholder from text to queueName for easier user…
codehdn f17dc83
feat: add support for effect queue length to be passed back to expres…
codehdn 7201738
Merge branch 'v5' into feature/effectQueueLength
SReject File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/backend/variables/builtin/utility/get-effect-queue-length.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { ReplaceVariable } from "../../../../types/variables"; | ||
| import { OutputDataType, VariableCategory } from "../../../../shared/variable-constants"; | ||
|
|
||
| import effectQueueManager from "../../../effects/queues/effect-queue-manager"; | ||
|
|
||
| const model : ReplaceVariable = { | ||
| definition: { | ||
| handle: "effectQueueLength", | ||
| usage: "effectQueueLength[queueName]", | ||
| description: "Returns the length of an effect queue. Useful for showing queue length in a command response.", | ||
| categories: [VariableCategory.ADVANCED], | ||
| possibleDataOutput: [OutputDataType.TEXT] | ||
| }, | ||
| evaluator: async (_trigger, text = "") => { | ||
| const selectedQueue = effectQueueManager.getAllItems().find((queue) => queue.name === text); | ||
| if (selectedQueue) { | ||
| return selectedQueue.length.toString(); | ||
| } | ||
| return "Unknown"; | ||
| } | ||
| }; | ||
|
|
||
| export default model; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding this so the express api also has easy access to this value. Its present when calling for all queues but not individual queues so assume just a small oversight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I implemented that originally, the paradigm was "fetch all queues, get length. Fetch specific queue, get the array of items instead for more advanced use"
the intention there was that if you needed the length, you'd get it from the array as the array is already present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely get it, I'm adding it for the less capable tools that can fetch against the api but only take the json key and don't permit any type of count/logic capabilities.