Browse Source

Parm required when registering.

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

25
src/discord/handlers/RegisterAccountHandler.java

@ -45,16 +45,16 @@ public class RegisterAccountHandler { @@ -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 { @@ -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.

Loading…
Cancel
Save