From dadba74e1952f213c22a0c6ff69654f14d6daa7d Mon Sep 17 00:00:00 2001 From: Derkades Date: Thu, 9 Jan 2025 21:44:17 +0100 Subject: [PATCH] Hide old configure commands for regular members as well --- .../java/com/namelessmc/bot/commands/PingCommand.java | 4 +++- src/main/java/com/namelessmc/bot/commands/URLCommand.java | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/namelessmc/bot/commands/PingCommand.java b/src/main/java/com/namelessmc/bot/commands/PingCommand.java index b98c352..42d41f1 100644 --- a/src/main/java/com/namelessmc/bot/commands/PingCommand.java +++ b/src/main/java/com/namelessmc/bot/commands/PingCommand.java @@ -10,6 +10,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; import net.dv8tion.jda.api.interactions.InteractionHook; +import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.Commands; @@ -21,7 +22,8 @@ public class PingCommand extends Command { @Override public CommandData getCommandData(final Language language) { - return Commands.slash(this.name, language.get(PING_DESCRIPTION)); + return Commands.slash(this.name, language.get(PING_DESCRIPTION)) + .setDefaultPermissions(DefaultMemberPermissions.DISABLED); } @Override diff --git a/src/main/java/com/namelessmc/bot/commands/URLCommand.java b/src/main/java/com/namelessmc/bot/commands/URLCommand.java index 3a443fb..374431c 100644 --- a/src/main/java/com/namelessmc/bot/commands/URLCommand.java +++ b/src/main/java/com/namelessmc/bot/commands/URLCommand.java @@ -3,8 +3,6 @@ import static com.namelessmc.bot.Language.Term.APIURL_DESCRIPTION; import org.checkerframework.checker.nullness.qual.Nullable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.namelessmc.bot.Language; import com.namelessmc.java_api.NamelessAPI; @@ -12,20 +10,20 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; import net.dv8tion.jda.api.interactions.InteractionHook; +import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.Commands; public class URLCommand extends Command { - private static final Logger LOGGER = LoggerFactory.getLogger(URLCommand.class); - URLCommand() { super("apiurl"); } @Override public CommandData getCommandData(final Language language) { - return Commands.slash(this.name, language.get(APIURL_DESCRIPTION)); + return Commands.slash(this.name, language.get(APIURL_DESCRIPTION)) + .setDefaultPermissions(DefaultMemberPermissions.DISABLED); } @Override