Open satyrnidae opened 5 years ago
In the latest commit, nick names are the final argument and do support spaces because of rest parameters. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters However, this means the arguments before it must be defined. Keeping this open because I would eventually like to add this in the way you suggested.
wouldn't it be possible to use yargs for the command? this could help (would also get rid of the specific order)
wouldn't it be possible to use yargs for the command? this could help (would also get rid of the specific order)
@AnthonyLenglet How would that work? Can you give an example?
Sent with GitHawk
yargs is for commands sent via the cmd, so I don't know if it works for any strings, but I'm assuming it would (guessing its just a matter of sending a string to a function and getting an object back)
!bingo -p @see --name="See Beyond" --time=10
would return
{
"person": "see<discordId>",
"name": "See Beyond",
"tomb": "Default",
"time": 10
}
Seems a bit to long. Would something like !bingo @user (this one will always be first and is always mandatory) -t 1m (this could be optional and have a default value) -n Nickname (this too) -s default (And this)
work? Because if so then I can make those changes
Sent with GitHawk
yargs is for commands sent via the cmd, so I don't know if it works for any strings, but I'm assuming it would (guessing its just a matter of sending a string to a function and getting an object back) ...
@AnthonyLenglet it seems https://www.npmjs.com/package/yargs-parser could be what we’re looking for
Sent with GitHawk
Currently args are split on spaces. This means that the user cannot specify a nickname unless it is all one word, or uses spacers like underlines or other non-letter characters. Proposal: a new tokenization function is introduced that will allow the user to specify a multiple word nickname by enclosing the corresponding argument between quotes.