Commando icon indicating copy to clipboard operation
Commando copied to clipboard

Allow to specify a specifc argument when sending a command to a bot.

Open noirscape opened this issue 7 years ago • 5 comments

At the moment it is not possible to specify an individual argument by a value when sending a command to a bot. It would be useful to add a command that permits you to specify a command by setting a property called argPrefix. The default for this property could be the value set to the key property.

Example

Take a command called foo. The foo command has two arguments: bar and round. bar and round both have a default value set to false. If you run foo it checks if one of the values is marked as true and if it is, it returns the argument(s) that were set to true.

Now say we only want to specify true for round and not want to have to specify false for bar in the command send to the bot. At the moment this is not possible with Commando.

I propose therefore adding a argPrefix property that, if specified, allows you to specify a specific command with the syntax (moving back to my example): $foo round=true for example.

But why?

Good question. My example foo command may only have had two arguments, but what if you for example have a command with fifteen arguments? In that case it can save a potential user a lot more time if for example they could only specify a single argument when the other arguments are provided by the default set in the bot itself.

The reasoning for splitting this configuration option from the key property is that the variable which is set in type might not be entirely useful to type out for a user to help them to identify the command.

noirscape avatar Nov 16 '17 14:11 noirscape

There's already a property called label, so you'd need to come up with a better name. This is also possible by using a parse function.

dragonfire535 avatar Nov 16 '17 14:11 dragonfire535

@dragonfire535 argPrefix could also work.

I also updated my OP to reflect this.

noirscape avatar Nov 16 '17 14:11 noirscape

Also I disagree with making type the default - should be the key.

dragonfire535 avatar Nov 16 '17 14:11 dragonfire535

@dragonfire535 that was just a wording mistake on my end. My bad, I've corrected it. In my mind the type and key properties switched around for a second 😛 .

noirscape avatar Nov 16 '17 14:11 noirscape

Good idea, just a bit confusing in the wording. 👍

oinkbark avatar Nov 26 '17 23:11 oinkbark