connect two commands
the Hi,
I've built two separate commands. one that generates image from text input, and the other one generates video from text input for script and an image source(URL, local file).
I want to add one other to the image source option for the video-generating command with the image-generating command output.
which means, I want to connect two commands into one command, although I can transfer my image-generating code to the second command and just asynchronously use the generated image for video source.
Can someone help me out with this?
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!i cannot follow your train of thought here, can you try to rephrase your question?
if you mean you want the same command to have two "branches" with different options like
that's sub commands: https://discordjs.guide/slash-commands/advanced-creation.html#subcommands
let say, i have 3 commands separately.
getWidth.js
getHeight.js
getArea.js
and I want to utilize the responds from two commands /getWidth and /getHeight in order to calculate area by calling the /getArea command.
is this still following sub command?
Sorry if my question is not clear to you.
So you could create a command that has two args for width and height, which then returns an output of the area.
/area <width> <height>
Based on what you said originally it sounds like you want to be able to generate an image and then generate a video with one command, while preserving the two seprate commands.
Is that correct?You should store the data from each use of the command and the use that data in the 3rd command
There’s a lot of ways to do that , like making a temp file , storing it in a db , etc
Yes, that's correct!
Okay, might have to look for some kind of state management tool or database
mongodb
good for starters