2929import java .util .Arrays ;
3030import java .util .List ;
3131import java .util .regex .Pattern ;
32- import java .util .stream .Collectors ;
3332
3433import static me .duncte123 .botcommons .messaging .MessageUtils .sendEmbed ;
3534import static me .duncte123 .botcommons .messaging .MessageUtils .sendMsg ;
@@ -70,19 +69,20 @@ public void execute(@Nonnull CommandContext ctx) {
7069 sendHelp (ctx , HelpEmbeds .generateCommandEmbed (prefix , null ));
7170 }
7271
73- @ SuppressWarnings ("ConstantConditions" )
7472 private boolean isCategory (String name ) {
7573 try {
76- final List <CommandCategory > categoryList = Arrays .stream (CommandCategory .values ()).filter (it -> name
77- .equalsIgnoreCase (it .getSearch ())).collect (Collectors .toList ());
74+ final List <CommandCategory > categoryList = Arrays .stream (CommandCategory .values ())
75+ .filter (it -> name .equalsIgnoreCase (it .getSearch ()))
76+ .toList ();
7877
7978 if (!categoryList .isEmpty ()) {
8079 return true ;
8180 }
8281
83- return CommandCategory .valueOf (name .toUpperCase ()) != null ;
84- }
85- catch (IllegalArgumentException ignored ) {
82+ // throws exception if not found
83+ CommandCategory .valueOf (name .toUpperCase ());
84+ return true ;
85+ } catch (IllegalArgumentException ignored ) {
8686 return false ;
8787 }
8888 }
@@ -100,7 +100,7 @@ private void sendHelp(CommandContext ctx, EmbedBuilder embed) {
100100
101101 private void sendCommandHelp (CommandContext ctx , String toSearch , CommandManager manager , String prefix ) {
102102
103- final ICommand cmd = manager .getCommand (toSearch );
103+ final ICommand < CommandContext > cmd = manager .getCommand (toSearch );
104104
105105 if (cmd != null ) {
106106 sendCommandHelpMessage (ctx , (Command ) cmd , prefix , toSearch );
@@ -117,7 +117,7 @@ private void sendCommandHelpMessage(CommandContext ctx, Command cmd, String pref
117117 final boolean isKotlin = isKotlin (commandClass );
118118 final String extension = isKotlin ? ".kt" : ".java" ;
119119 final String type = isKotlin ? "kotlin" : "java" ;
120- final String url = String .format ("https://github.com/DuncteBot/SkyBot/blob/master /src/main/%s/%s%s" , type , clsPath , extension );
120+ final String url = String .format ("https://github.com/DuncteBot/SkyBot/blob/main/bot /src/main/%s/%s%s" , type , clsPath , extension );
121121
122122 final EmbedBuilder builder = EmbedUtils
123123 .getDefaultEmbed ()
0 commit comments