= Fixed choose to display help when there are no arguments provided

This commit is contained in:
Matthew Cech
2019-06-17 22:01:47 -07:00
parent 85c30f9e84
commit ede40ef9e3
2 changed files with 10 additions and 3 deletions
+7
View File
@@ -19,7 +19,14 @@ public class CommandChoose extends Command
@Override @Override
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{ {
if(input.args.trim().length() == 0)
{
res.Call(Stats.instance.GetHelpText(input.key));
return;
}
String [] choices = input.args.split(","); String [] choices = input.args.split(",");
if(choices.length == 1) if(choices.length == 1)
{ {
res.Call(LocStrings.Stub("ChooseOne")); res.Call(LocStrings.Stub("ChooseOne"));
+3 -3
View File
@@ -111,12 +111,12 @@ public class CommandManager
} }
// Looks up command by name. If it exists, dumps help text, otherwise returns null. // Looks up command by name. If it exists, dumps help text, otherwise returns null.
public String GetCommandHelpText(String lookup) public String GetCommandHelpText(String key)
{ {
Command command = commands.get(lookup); Command command = commands.get(key);
if(command != null) if(command != null)
return command.HelpText(); return "`" + key + "`: " + command.HelpText();
return null; return null;
} }