Set isVisible to default to true

java-rewrite
Hammy 3 years ago
parent be9d51420a
commit ebefe3f991

@ -17,7 +17,7 @@ import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.OptionType;
@SlashCommand(name = "avatar", description = "Display your avatar", isVisible = true) @SlashCommand(name = "avatar", description = "Display your avatar")
public class Avatar { public class Avatar {
private final EmbedService embedService; private final EmbedService embedService;
private final ImageService imageService; private final ImageService imageService;

@ -7,7 +7,7 @@ import me.goudham.service.EmbedService;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
@SlashCommand(name = "ping", description = "Display the latency of the bot", isVisible = true) @SlashCommand(name = "ping", description = "Display the latency of the bot")
public class Ping { public class Ping {
private final EmbedService embedService; private final EmbedService embedService;

@ -113,7 +113,7 @@ public class SlashCommandLoader implements CommandLoader {
if (slashCommand != null) { if (slashCommand != null) {
String name = slashCommand.stringValue("name").orElseThrow(); String name = slashCommand.stringValue("name").orElseThrow();
String description = slashCommand.stringValue("description").orElseThrow(); String description = slashCommand.stringValue("description").orElseThrow();
boolean isVisible = slashCommand.booleanValue("isVisible").orElseThrow(); boolean isVisible = slashCommand.booleanValue("isVisible").orElse(true);
String[] subCommandGroups = slashCommand.stringValues("subCommandGroups"); String[] subCommandGroups = slashCommand.stringValues("subCommandGroups");
CommandData commandData = new CommandData(name, description).setDefaultEnabled(isVisible); CommandData commandData = new CommandData(name, description).setDefaultEnabled(isVisible);

@ -16,7 +16,7 @@ import java.lang.annotation.Target;
public @interface SlashCommand { public @interface SlashCommand {
String name(); String name();
String description(); String description();
boolean isVisible(); boolean isVisible() default true;
String[] subCommandGroups() default {}; String[] subCommandGroups() default {};
Option[] options() default {}; Option[] options() default {};
} }

Loading…
Cancel
Save