diff --git a/src/discord/handlers/RegisterAccountHandler.java b/src/discord/handlers/RegisterAccountHandler.java index ac6c427e..eef45cf3 100644 --- a/src/discord/handlers/RegisterAccountHandler.java +++ b/src/discord/handlers/RegisterAccountHandler.java @@ -45,16 +45,16 @@ public class RegisterAccountHandler { return; } - // if user supplied argument let's validate it. - // otherwise build an account name based on their discord account. + // User must supply an account name if (args.length != 1) { - // Build account name using Discord name along with their discriminator. - - accountName = discordUserName.replaceAll("\\s+", ""); - accountName += "#" + event.getAuthor().getDiscriminator(); - } else { + MagicBot.sendResponse(event, + "Your supplied account name does not compute.\n" + + "Account names must satisfy following regex:\n" + + "^[\\p{Alnum}]{6,20}$"); + return; + } // Validate account name with regex @@ -69,12 +69,11 @@ public class RegisterAccountHandler { return; } - if (accountName.toLowerCase().equals("accountname")) { - MagicBot.sendResponse(event, - "accountname is not valid account name.\n" + - "Have brain player!"); - return; - } + if (accountName.equalsIgnoreCase("accountname")) { + MagicBot.sendResponse(event, + "accountname is not valid account name.\n" + + "Have brain player!"); + return; } // Make sure account doesn't already exist.