A command such as !time may require several options: One to add, another to remove, and one to show. They may be called by !time add [nick] [zone], !time remove [nick], and !time [nick]. Currently, to implement this, you may do something like
void time(string[] args...){
switch(args[0].toLower){
case "add": ... break;
case "remove": ... break;
default: ... break;
}
}
My suggestion is to define multiple functions which state which option they accept, delimited by an underscore
A command such as !time may require several options: One to add, another to remove, and one to show. They may be called by !time add [nick] [zone], !time remove [nick], and !time [nick]. Currently, to implement this, you may do something like
My suggestion is to define multiple functions which state which option they accept, delimited by an underscore
In addition to better code readability, this change would make the options for a command more visible when using !help.