use a perm check for the list buttons
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m10s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m10s
This commit is contained in:
parent
7bf468b470
commit
d70a29d363
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user