|
12 | 12 | import java.util.List;
|
13 | 13 |
|
14 | 14 | /**
|
15 |
| - * Abstract class that represents an executable Slash Command (excluding Subcommand Groups). |
| 15 | + * Allows to set Component-IDs which get handled within the extending class. |
| 16 | + * Best used in combination with {@link ComponentIdBuilder}. |
16 | 17 | *
|
17 | 18 | * @since v1.4
|
18 | 19 | */
|
@@ -40,15 +41,15 @@ public boolean shouldHandleAutoComplete() {
|
40 | 41 | * override its method.
|
41 | 42 | *
|
42 | 43 | * <pre>{@code
|
43 |
| - * public class PingCommand extends GuildSlashCommand implements AutoCompleteHandler { |
| 44 | + * public class PingCommand extends SlashCommand implements AutoCompleteHandler { |
44 | 45 | *
|
45 |
| - * public PingCommand(Guild guild) { |
| 46 | + * public PingCommand() { |
46 | 47 | * setCommandData(Commands.slash("ping", "Ping someone").addOption(OptionType.STRING, "user-id", "The user's id"));
|
47 | 48 | * enableAutoCompleteHandling();
|
48 | 49 | * }
|
49 | 50 | *
|
50 | 51 | * @Override
|
51 |
| - * public void handleSlashCommand(SlashCommandInteractionEvent event) { |
| 52 | + * public void execute(SlashCommandInteractionEvent event) { |
52 | 53 | * OptionMapping mapping = event.getOption("user-id");
|
53 | 54 | * String userId = mapping.getAsString();
|
54 | 55 | * event.replyFormat("Ping! <@%s>", userId).queue();
|
@@ -93,7 +94,7 @@ public List<String> getHandledButtonIds() {
|
93 | 94 | * <pre>{@code
|
94 | 95 | * public class TestCommand extends SlashCommand {
|
95 | 96 | *
|
96 |
| - * public TestCommand(Guild guild) { |
| 97 | + * public TestCommand() { |
97 | 98 | * setCommandData(Commands.slash("test", "test description"));
|
98 | 99 | * handleButtonIds("test-button");
|
99 | 100 | * }
|
@@ -136,7 +137,7 @@ public void handleButtonIds(String... handledButtonIds) {
|
136 | 137 | * <pre>{@code
|
137 | 138 | * public class TestCommand extends SlashCommand {
|
138 | 139 | *
|
139 |
| - * public TestCommand(Guild guild) { |
| 140 | + * public TestCommand() { |
140 | 141 | * setCommandData(Commands.slash("test", "test description"));
|
141 | 142 | * handleButtonIds("test-button");
|
142 | 143 | * }
|
@@ -184,13 +185,13 @@ public List<String> getHandledSelectMenuIds() {
|
184 | 185 | * <pre>{@code
|
185 | 186 | * public class TestCommand extends GuildSlashCommand implements SelectMenuHandler {
|
186 | 187 | *
|
187 |
| - * public TestCommand(Guild guild) { |
| 188 | + * public TestCommand() { |
188 | 189 | * setCommandData(Commands.slash("test", "test description"));
|
189 | 190 | * handleSelectMenuIds("test-select-menu");
|
190 | 191 | * }
|
191 | 192 | *
|
192 | 193 | * @Override
|
193 |
| - * public void handleSlashCommand(SlashCommandInteractionEvent event) { |
| 194 | + * public void execute(SlashCommandInteractionEvent event) { |
194 | 195 | * List<Role> roles = [...]
|
195 | 196 | * SelectMenu.Builder menu = SelectMenu.create("test-select-menu");
|
196 | 197 | * for (Role role : roles) {
|
@@ -224,7 +225,7 @@ public void handleSelectMenuIds(String... handledSelectMenuIds) {
|
224 | 225 | * <pre>{@code
|
225 | 226 | * public class TestCommand extends SlashCommand {
|
226 | 227 | *
|
227 |
| - * public TestCommand(Guild guild) { |
| 228 | + * public TestCommand() { |
228 | 229 | * setCommandData(Commands.slash("test", "test description"));
|
229 | 230 | * handleSelectMenuIds("test-select-menu");
|
230 | 231 | * }
|
@@ -270,7 +271,7 @@ public List<String> getHandledModalIds() {
|
270 | 271 | * <pre>{@code
|
271 | 272 | * public class TestCommand extends SlashCommand {
|
272 | 273 | *
|
273 |
| - * public TestCommand(Guild guild) { |
| 274 | + * public TestCommand() { |
274 | 275 | * setCommandData(Commands.slash("test", "test description"));
|
275 | 276 | * handleModalIds("test-modal");
|
276 | 277 | * }
|
@@ -324,7 +325,7 @@ public void handleModalIds(String... handledModalIds) {
|
324 | 325 | * <pre>{@code
|
325 | 326 | * public class TestCommand extends SlashCommand {
|
326 | 327 | *
|
327 |
| - * public TestCommand(Guild guild) { |
| 328 | + * public TestCommand() { |
328 | 329 | * setCommandData(Commands.slash("test", "test description"));
|
329 | 330 | * handleModalIds("test-modal");
|
330 | 331 | * }
|
|
0 commit comments