Skip to content

Commit 726330d

Browse files
updated some docs
1 parent ee60880 commit 726330d

File tree

7 files changed

+37
-18
lines changed

7 files changed

+37
-18
lines changed

src/main/java/com/dynxsty/dih4jda/interactions/ComponentIdBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.stream.Collectors;
55

66
/**
7-
* Utility class that allows for easy and consistent component-id building.
7+
* Utility class that allows for easy and consistent Component-ID building.
88
*
99
* @since v1.4
1010
*/

src/main/java/com/dynxsty/dih4jda/interactions/commands/CommandRequirements.java

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
import java.util.HashSet;
77
import java.util.Set;
88

9+
/**
10+
* Allows to set requirements that must be met in order to execute the command.
11+
* If a requirement isn't met, this will fire the corresponding event in {@link com.dynxsty.dih4jda.events.DIH4JDAListenerAdapter}.
12+
*
13+
* @since v1.5
14+
*/
915
public abstract class CommandRequirements extends ComponentHandler {
1016
private final Set<Permission> requiredPermissions = new HashSet<>();
1117
private final Set<Long> requiredUsers = new HashSet<>();

src/main/java/com/dynxsty/dih4jda/interactions/commands/ComponentHandler.java

+12-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import java.util.List;
1313

1414
/**
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}.
1617
*
1718
* @since v1.4
1819
*/
@@ -40,15 +41,15 @@ public boolean shouldHandleAutoComplete() {
4041
* override its method.
4142
*
4243
* <pre>{@code
43-
* public class PingCommand extends GuildSlashCommand implements AutoCompleteHandler {
44+
* public class PingCommand extends SlashCommand implements AutoCompleteHandler {
4445
*
45-
* public PingCommand(Guild guild) {
46+
* public PingCommand() {
4647
* setCommandData(Commands.slash("ping", "Ping someone").addOption(OptionType.STRING, "user-id", "The user's id"));
4748
* enableAutoCompleteHandling();
4849
* }
4950
*
5051
* @Override
51-
* public void handleSlashCommand(SlashCommandInteractionEvent event) {
52+
* public void execute(SlashCommandInteractionEvent event) {
5253
* OptionMapping mapping = event.getOption("user-id");
5354
* String userId = mapping.getAsString();
5455
* event.replyFormat("Ping! <@%s>", userId).queue();
@@ -93,7 +94,7 @@ public List<String> getHandledButtonIds() {
9394
* <pre>{@code
9495
* public class TestCommand extends SlashCommand {
9596
*
96-
* public TestCommand(Guild guild) {
97+
* public TestCommand() {
9798
* setCommandData(Commands.slash("test", "test description"));
9899
* handleButtonIds("test-button");
99100
* }
@@ -136,7 +137,7 @@ public void handleButtonIds(String... handledButtonIds) {
136137
* <pre>{@code
137138
* public class TestCommand extends SlashCommand {
138139
*
139-
* public TestCommand(Guild guild) {
140+
* public TestCommand() {
140141
* setCommandData(Commands.slash("test", "test description"));
141142
* handleButtonIds("test-button");
142143
* }
@@ -184,13 +185,13 @@ public List<String> getHandledSelectMenuIds() {
184185
* <pre>{@code
185186
* public class TestCommand extends GuildSlashCommand implements SelectMenuHandler {
186187
*
187-
* public TestCommand(Guild guild) {
188+
* public TestCommand() {
188189
* setCommandData(Commands.slash("test", "test description"));
189190
* handleSelectMenuIds("test-select-menu");
190191
* }
191192
*
192193
* @Override
193-
* public void handleSlashCommand(SlashCommandInteractionEvent event) {
194+
* public void execute(SlashCommandInteractionEvent event) {
194195
* List<Role> roles = [...]
195196
* SelectMenu.Builder menu = SelectMenu.create("test-select-menu");
196197
* for (Role role : roles) {
@@ -224,7 +225,7 @@ public void handleSelectMenuIds(String... handledSelectMenuIds) {
224225
* <pre>{@code
225226
* public class TestCommand extends SlashCommand {
226227
*
227-
* public TestCommand(Guild guild) {
228+
* public TestCommand() {
228229
* setCommandData(Commands.slash("test", "test description"));
229230
* handleSelectMenuIds("test-select-menu");
230231
* }
@@ -270,7 +271,7 @@ public List<String> getHandledModalIds() {
270271
* <pre>{@code
271272
* public class TestCommand extends SlashCommand {
272273
*
273-
* public TestCommand(Guild guild) {
274+
* public TestCommand() {
274275
* setCommandData(Commands.slash("test", "test description"));
275276
* handleModalIds("test-modal");
276277
* }
@@ -324,7 +325,7 @@ public void handleModalIds(String... handledModalIds) {
324325
* <pre>{@code
325326
* public class TestCommand extends SlashCommand {
326327
*
327-
* public TestCommand(Guild guild) {
328+
* public TestCommand() {
328329
* setCommandData(Commands.slash("test", "test description"));
329330
* handleModalIds("test-modal");
330331
* }

src/main/java/com/dynxsty/dih4jda/interactions/commands/ContextCommand.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*
1212
* @see ContextCommand.User#execute(UserContextInteractionEvent)
1313
* @see ContextCommand.Message#execute(MessageContextInteractionEvent)
14+
*
15+
* @since v1.5
1416
*/
1517
public abstract class ContextCommand extends ExecutableCommand {
1618
private CommandData commandData;
@@ -42,14 +44,14 @@ public abstract static class User extends ContextCommand {
4244
* Abstract method that must be implemented for all User Context Commands.
4345
*
4446
* <pre>{@code
45-
* public class PingContextMenu extends GuildContextCommand implements UserContextCommand {
47+
* public class PingContextMenu extends ContextCommand.User {
4648
*
4749
* public PingContextMenu() {
4850
* this.setCommandData(Commands.user("Ping"));
4951
* }
5052
*
5153
* @Override
52-
* public void handleUserContextInteraction(UserContextInteractionEvent event) {
54+
* public void execute(UserContextInteractionEvent event) {
5355
* event.reply("Pong!").queue();
5456
* }
5557
* }}

src/main/java/com/dynxsty/dih4jda/interactions/commands/ExecutableCommand.java

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
import java.util.Set;
1111
import java.util.stream.Collectors;
1212

13+
/**
14+
* Represents a single, executable command.
15+
*
16+
* @see ContextCommand
17+
* @see SlashCommand
18+
*
19+
* @since v1.5
20+
*/
1321
public abstract class ExecutableCommand extends CommandRequirements {
1422
private final Set<Long> whitelistedGuilds = new HashSet<>();
1523
private final Set<Long> blacklistedGuilds = new HashSet<>();

src/main/java/com/dynxsty/dih4jda/interactions/commands/SlashCommand.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData;
77

88
/**
9-
* Model class which represents a single Slash Command.
9+
* Represents a single Slash Command.
1010
*
1111
* @see SlashCommand#execute(SlashCommandInteractionEvent)
12+
*
13+
* @since v1.5
1214
*/
1315
public abstract class SlashCommand extends ExecutableCommand {
1416

@@ -25,7 +27,7 @@ protected SlashCommand() {
2527
* <pre>{@code
2628
* public class PingCommand extends SlashCommand {
2729
*
28-
* public PingCommand(Guild guild) {
30+
* public PingCommand() {
2931
* setCommandData(Commands.slash("ping", "Ping!"));
3032
* }
3133
*
@@ -112,7 +114,7 @@ public void setSubcommandData(SubcommandData subCommandData) {
112114
* <pre>{@code
113115
* public class PingCommand extends SlashCommand.Subcommand {
114116
*
115-
* public PingCommand(Guild guild) {
117+
* public PingCommand() {
116118
* setSubcommandData(Commands.slash("ping", "Ping!"));
117119
* }
118120
*

src/main/java/com/dynxsty/dih4jda/util/Pair.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.dynxsty.dih4jda.util;
22

33
/**
4-
* Data class which holds two values.
4+
* A Pair of two elements.
55
*
66
* @param <F> The first value.
77
* @param <S> The second value.

0 commit comments

Comments
 (0)