Refactor CommandStaffJoinDate initialization

Correctly initialize and return the CommandData object for cleaner code. This change ensures proper usage of the command data and handles the auto-complete interaction correctly.
This commit is contained in:
Teriuihi 2024-08-25 19:47:34 +02:00
parent 8f6d1137ae
commit 1f706b69b8

View File

@ -27,8 +27,10 @@ import java.util.stream.Collectors;
public class CommandStaffJoinDate extends DiscordCommand { public class CommandStaffJoinDate extends DiscordCommand {
private final CommandData commandData;
public CommandStaffJoinDate(JDA jda, CommandManager commandManager) { public CommandStaffJoinDate(JDA jda, CommandManager commandManager) {
CommandData commandData = Commands.slash(getName(), "View join date for staff members, or add them manually") this.commandData = Commands.slash(getName(), "View join date for staff members, or add them manually")
.addOption(OptionType.MENTIONABLE, "staff", "Set the soft lock \"on\" or \"off\"", false, false) .addOption(OptionType.MENTIONABLE, "staff", "Set the soft lock \"on\" or \"off\"", false, false)
.addOption(OptionType.NUMBER, "join-time", "Channel to change soft lock state for", false, false) .addOption(OptionType.NUMBER, "join-time", "Channel to change soft lock state for", false, false)
.setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.ADMINISTRATOR)) .setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.ADMINISTRATOR))
@ -104,7 +106,7 @@ public class CommandStaffJoinDate extends DiscordCommand {
@Override @Override
public void suggest(CommandAutoCompleteInteractionEvent event) { public void suggest(CommandAutoCompleteInteractionEvent event) {
event.replyChoiceStrings(List.of()).queue();
} }
@Override @Override
@ -114,6 +116,6 @@ public class CommandStaffJoinDate extends DiscordCommand {
@Override @Override
public CommandData getCommandData() { public CommandData getCommandData() {
return null; return commandData;
} }
} }