|
|
|
@ -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,13 +69,12 @@ public class RegisterAccountHandler {
@@ -69,13 +69,12 @@ public class RegisterAccountHandler {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (accountName.toLowerCase().equals("accountname")) { |
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|