Closed NanoSector closed 9 years ago
Additionally, with the help module, it could be extended to take a different usage string for each number of arguments, with $usage[0] = '!command'; $usage[1] = '!command [parameter]'; And so on.
Fixed something up locally. Committing in a bit.
PR #54 should fix this, though it has a merge conflict. I'm not familiar with solving those, any help?
Oh I see now - the hostname verification commit was screwing up things. Recreating the PR.
Right now, if your command allows both no and 1 argument, you have to set it to -1 (because 1 will error out with no arguments), allowing more than one argument to be passed, requiring you to validate the amount of arguments yourself.
A possible solution would be passing an array to the $numberOfArguments variable, containing (0,1) or similar. Then the command interpreter would check for in_array(count($arguments), $this->numberOfArguments) if the variable is an array; else simply check count($arguments) == $this->numberOfArguments like it does now.