Fix command label being passed as arg in case of no args

This commit is contained in:
Bea 2022-12-19 00:22:51 +01:00
parent 9504921f27
commit b0a1381589
2 changed files with 3 additions and 3 deletions

View File

@ -34,8 +34,8 @@ public class SayCommand implements MessageCommand
public void runCommand(MessageReceivedEvent event, String label, String[] args)
{
String messageContent = "";
if(args.length != 0)
String messageContent;
if(args.length != 0 && !args[0].isEmpty())
{
messageContent = args[0];
} else {

View File

@ -123,7 +123,7 @@ public class MessageCommandListener extends ListenerAdapter
{
// remove first argument, which is the command label
argsString = argsString.replaceAll("^[\\S]+\\s+", "");
argsString = argsString.replaceAll("^[\\S]+\\s*", "");
// pass all other arguments as a single argument as the first array element
commandArgs = new String[]{argsString};
}