File tree Expand file tree Collapse file tree 4 files changed +7
-3
lines changed
src/main/java/vc/commands Expand file tree Collapse file tree 4 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1111import vc .api .model .LabyProfileSearchResponse ;
1212import vc .openapi .handler .ApiException ;
1313import vc .util .DiscordMarkdownEscape ;
14+ import vc .util .Validator ;
1415
1516import java .net .http .HttpTimeoutException ;
1617
@@ -36,6 +37,9 @@ public Mono<Message> handle(final ChatInputInteractionEvent event) {
3637 if (player == null ) {
3738 return error (event , "`player` option is required" );
3839 }
40+ if (!Validator .isValidPlayerName (player )) {
41+ return error (event , "Invalid player name" );
42+ }
3943 LabyProfileSearchResponse searchResponse ;
4044 try {
4145 searchResponse = labyRestClient .searchProfiles (player );
Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ private ChatInteractionOptionContext resolveProfileSubOption(final ChatInteracti
346346 }
347347 Optional <ProfileData > playerIdentity = playerLookup .getPlayerIdentity (playerName );
348348 if (playerIdentity .isEmpty ()) {
349- ctx .setError ("No player named `%s` exists" .formatted (playerName ));
349+ ctx .setError ("No player named `%s` exists\n Check for previous accounts with `/names` " .formatted (playerName ));
350350 return ctx ;
351351 }
352352 ctx .profileData = playerIdentity .get ();
Original file line number Diff line number Diff line change @@ -462,7 +462,7 @@ private ChatInteractionOptionContext resolveProfileSubOption(final ChatInteracti
462462 }
463463 Optional <ProfileData > playerIdentity = playerLookup .getPlayerIdentity (playerName );
464464 if (playerIdentity .isEmpty ()) {
465- ctx .setError ("No player named `%s` exists" .formatted (playerName ));
465+ ctx .setError ("No player named `%s` exists\n Check for previous accounts with `/names` " .formatted (playerName ));
466466 return ctx ;
467467 }
468468 ctx .profileData = playerIdentity .get ();
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public void apply(final ChatInteractionOptionContext context) {
3333 }
3434 Optional <ProfileData > playerIdentity = playerLookup .getPlayerIdentity (playerName );
3535 if (playerIdentity .isEmpty ()) {
36- context .setError ("No player named `" + playerName + "` exists" );
36+ context .setError ("No player named `" + playerName + "` exists\n Check for previous accounts with `/names` " );
3737 return ;
3838 }
3939 context .profileData = playerIdentity .get ();
You can’t perform that action at this time.
0 commit comments