10
10
import net .dv8tion .jda .api .interactions .commands .OptionMapping ;
11
11
import net .dv8tion .jda .api .interactions .commands .OptionType ;
12
12
import net .dv8tion .jda .api .interactions .commands .build .OptionData ;
13
- import net .dv8tion .jda .api .interactions .commands .build .SubcommandData ;
14
13
import net .dv8tion .jda .api .interactions .components .ActionRow ;
15
14
import net .dv8tion .jda .api .interactions .components .ComponentInteraction ;
16
15
import net .dv8tion .jda .api .interactions .components .selections .SelectOption ;
@@ -44,9 +43,6 @@ public final class RoleSelectCommand extends SlashCommandAdapter {
44
43
45
44
private static final Logger logger = LoggerFactory .getLogger (RoleSelectCommand .class );
46
45
47
- private static final String ALL_OPTION = "all" ;
48
- private static final String CHOOSE_OPTION = "choose" ;
49
-
50
46
private static final String TITLE_OPTION = "title" ;
51
47
private static final String DESCRIPTION_OPTION = "description" ;
52
48
@@ -65,15 +61,7 @@ public RoleSelectCommand() {
65
61
super ("role-select" , "Sends a message where users can select their roles" ,
66
62
SlashCommandVisibility .GUILD );
67
63
68
- SubcommandData allRoles =
69
- new SubcommandData (ALL_OPTION , "Lists all the rolls in the server for users" )
70
- .addOptions (messageOptions );
71
-
72
- SubcommandData selectRoles =
73
- new SubcommandData (CHOOSE_OPTION , "Choose the roles for users to select" )
74
- .addOptions (messageOptions );
75
-
76
- getData ().addSubcommands (allRoles , selectRoles );
64
+ getData ().addOptions (messageOptions );
77
65
}
78
66
79
67
@ NotNull
@@ -107,14 +95,8 @@ public void onSlashCommand(@NotNull final SlashCommandEvent event) {
107
95
108
96
SelectionMenu .Builder menu =
109
97
SelectionMenu .create (generateComponentId (Lifespan .PERMANENT , member .getId ()));
110
- boolean isEphemeral = false ;
111
98
112
- if (CHOOSE_OPTION .equals (event .getSubcommandName ())) {
113
- addMenuOptions (event , menu , "Select the roles to display" , 1 );
114
- isEphemeral = true ;
115
- } else {
116
- addMenuOptions (event , menu , "Select your roles" , 0 );
117
- }
99
+ addMenuOptions (event , menu , "Select the roles to display" , 1 );
118
100
119
101
// Handle Optional arguments
120
102
OptionMapping titleOption = event .getOption (TITLE_OPTION );
@@ -126,13 +108,7 @@ public void onSlashCommand(@NotNull final SlashCommandEvent event) {
126
108
MessageBuilder messageBuilder = new MessageBuilder (makeEmbed (title , description ))
127
109
.setActionRows (ActionRow .of (menu .build ()));
128
110
129
- if (isEphemeral ) {
130
- event .reply (messageBuilder .build ()).setEphemeral (true ).queue ();
131
- } else {
132
- event .getChannel ().sendMessage (messageBuilder .build ()).queue ();
133
-
134
- event .reply ("Message sent successfully!" ).setEphemeral (true ).queue ();
135
- }
111
+ event .reply (messageBuilder .build ()).setEphemeral (true ).queue ();
136
112
}
137
113
138
114
/**
@@ -325,4 +301,4 @@ private static void handleRoleModifications(@NotNull final Interaction event,
325
301
return null ;
326
302
}
327
303
}
328
- }
304
+ }
0 commit comments