From ebefe3f9912e60657a0af3737ba29a389629d59e Mon Sep 17 00:00:00 2001 From: Hammy Date: Fri, 24 Sep 2021 02:21:33 +0100 Subject: [PATCH] Set isVisible to default to true --- src/main/java/me/goudham/bot/command/info/Avatar.java | 2 +- src/main/java/me/goudham/bot/command/info/Ping.java | 2 +- src/main/java/me/goudham/command/SlashCommandLoader.java | 2 +- src/main/java/me/goudham/command/annotation/SlashCommand.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/goudham/bot/command/info/Avatar.java b/src/main/java/me/goudham/bot/command/info/Avatar.java index 48f89100..c9ee5663 100644 --- a/src/main/java/me/goudham/bot/command/info/Avatar.java +++ b/src/main/java/me/goudham/bot/command/info/Avatar.java @@ -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.OptionType; -@SlashCommand(name = "avatar", description = "Display your avatar", isVisible = true) +@SlashCommand(name = "avatar", description = "Display your avatar") public class Avatar { private final EmbedService embedService; private final ImageService imageService; diff --git a/src/main/java/me/goudham/bot/command/info/Ping.java b/src/main/java/me/goudham/bot/command/info/Ping.java index 2e06c7ad..131647b1 100644 --- a/src/main/java/me/goudham/bot/command/info/Ping.java +++ b/src/main/java/me/goudham/bot/command/info/Ping.java @@ -7,7 +7,7 @@ import me.goudham.service.EmbedService; import net.dv8tion.jda.api.JDA; 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 { private final EmbedService embedService; diff --git a/src/main/java/me/goudham/command/SlashCommandLoader.java b/src/main/java/me/goudham/command/SlashCommandLoader.java index df4b8d34..225b49ca 100644 --- a/src/main/java/me/goudham/command/SlashCommandLoader.java +++ b/src/main/java/me/goudham/command/SlashCommandLoader.java @@ -113,7 +113,7 @@ public class SlashCommandLoader implements CommandLoader { if (slashCommand != null) { String name = slashCommand.stringValue("name").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"); CommandData commandData = new CommandData(name, description).setDefaultEnabled(isVisible); diff --git a/src/main/java/me/goudham/command/annotation/SlashCommand.java b/src/main/java/me/goudham/command/annotation/SlashCommand.java index ba1653c8..ff8d52e3 100644 --- a/src/main/java/me/goudham/command/annotation/SlashCommand.java +++ b/src/main/java/me/goudham/command/annotation/SlashCommand.java @@ -16,7 +16,7 @@ import java.lang.annotation.Target; public @interface SlashCommand { String name(); String description(); - boolean isVisible(); + boolean isVisible() default true; String[] subCommandGroups() default {}; Option[] options() default {}; }