Skip to content

Commit c9b8683

Browse files
authored
chore: Rename getCommandName to getName and getContexts now returns a Set (#5)
1 parent 84efd71 commit c9b8683

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/java/dev/tonimatas/cjda/internal/CJDAImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
6161
@Override
6262
public void registerCommand(SlashCommand command) {
6363
if (isRegistered(command)) {
64-
LOGGER.error("Slash command {} is already registered!", command.getCommandName());
64+
LOGGER.error("Slash command {} is already registered!", command.getName());
6565
return;
6666
}
6767

68-
slashCommands.put(command.getCommandName(), command);
68+
slashCommands.put(command.getName(), command);
6969
}
7070

7171
@Override
@@ -82,7 +82,7 @@ public CommandListUpdateAction init() {
8282
List<SlashCommandData> slashCommandDataList = new ArrayList<>();
8383

8484
for (SlashCommand command : slashCommands.values()) {
85-
SlashCommandData data = Commands.slash(command.getCommandName(), command.getDescription());
85+
SlashCommandData data = Commands.slash(command.getName(), command.getDescription());
8686

8787
if (localization != null) {
8888
data.setLocalizationFunction(localization);
@@ -98,6 +98,6 @@ public CommandListUpdateAction init() {
9898
}
9999

100100
private boolean isRegistered(SlashCommand command) {
101-
return slashCommands.get(command.getCommandName()) != null;
101+
return slashCommands.get(command.getName()) != null;
102102
}
103103
}

src/main/java/dev/tonimatas/cjda/slash/SlashCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
66
import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData;
77

8-
import java.util.List;
8+
import java.util.Set;
99

1010
/**
1111
* Slash command interface for CJDA.
1212
* @author TonimatasDEV
1313
*/
1414
public interface SlashCommand {
1515
/**
16-
* It is called when a slash command with the {@link SlashCommand#getCommandName()} is executed in Discord.
16+
* It is called when a slash command with the {@link SlashCommand#getName()} is executed in Discord.
1717
*
1818
* @param interaction The slash command interaction that contains important information
1919
*/
@@ -36,7 +36,7 @@ default SlashCommandData init(SlashCommandData data) {
3636
*
3737
* @return The command name
3838
*/
39-
String getCommandName();
39+
String getName();
4040

4141
/**
4242
* Used to add a default command description {@link SlashCommandData#setDescription(String)}.
@@ -51,5 +51,5 @@ default SlashCommandData init(SlashCommandData data) {
5151
*
5252
* @return The command contexts
5353
*/
54-
List<InteractionContextType> getContexts();
54+
Set<InteractionContextType> getContexts();
5555
}

0 commit comments

Comments
 (0)