Closed quinnvaughn closed 3 years ago
Do you have an example of how you think this would work?
My first thought would assume something like this:
// Message: -command May the force be with you
const args = message.args
args[0] = may
args[1] = the
args[2] = force
...
But this still has many questionable issues with it.
I would think you'd specify in the string and it would check for that.
Something like
@Command("create :name :type\array")
Wouldn't have to be exactly that, but just some wording it would parse for to let it be known that it's an array (the type arg in this example).
I'm not sure if in that case, it would require it to be enclosed by brackets in the command or if it just could only be the last argument. You might be able to specify the escape character.
Right now what I'm doing is taking multiple inputs by splitting the command after the command text, and then regexing it by strings enclosed in double-quotes, but I think this library probably could do that automatically for us.
Basically like this:
!prefix submit "this is one" "this is two"
I agree that when something is surrounded by quotes, it should be parsed as a single arg. However, I don't think parsing multiple args as an array is realistic. Maybe edit the issue to only be about quoted args?
This should be fixed in the slash commands version (5.x) 🙂
Is there an easy way to just get the args as one array? Adding an actual :args only gets the first or however many, but I'm looking for an indeterminant amount of inputs (well up to 5).