Browse Source

Parm required when registering.

master
MagicBot 1 year ago
parent
commit
003916d393
  1. 17
      src/discord/handlers/RegisterAccountHandler.java

17
src/discord/handlers/RegisterAccountHandler.java

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

Loading…
Cancel
Save