diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java index bf1bdea..862615e 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java @@ -44,14 +44,19 @@ public class ListSubCommand extends BatCommand implements EventListener { @Override public void onButtonInteraction(BatGuild guild, @NonNull BatUser user, @NonNull ButtonInteractionEvent event) { - if (guild == null) { + if (guild == null || event.getMember() == null) { return; } - // The person who clicked the button is not the person who executed the command - Message referencedMessage = event.getMessage().getReferencedMessage(); - if (referencedMessage != null && !referencedMessage.getAuthor().getId().equals(user.getId())) { - event.reply("%s, you cannot use this button.".formatted(user.getDiscordUser().getAsMention())).setEphemeral(true).queue(); + // Not a log button + if (!event.getComponentId().startsWith("logs")) { + return; + } + + if (!event.getMember().hasPermission(this.getInfo().getPermissions())) { + event.reply("%s, you cannot use this button.".formatted(user.getDiscordUser().getAsMention())) + .setEphemeral(true) + .queue(); return; } @@ -61,11 +66,6 @@ public class ListSubCommand extends BatCommand implements EventListener { return; } - // Not a log category - if (!event.getComponentId().startsWith("logs:list:")) { - return; - } - // Category String[] split = event.getComponentId().split(":"); if (split.length != 3) {