Skip to content

Commit 396ced8

Browse files
fixed config permission checks
1 parent f8cbd6a commit 396ced8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/net/javadiscord/javabot/systems/configuration/ConfigSubcommand.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.javadiscord.javabot.Bot;
77
import net.javadiscord.javabot.data.config.GuildConfig;
88
import net.javadiscord.javabot.data.config.UnknownPropertyException;
9+
import net.javadiscord.javabot.util.Checks;
910
import net.javadiscord.javabot.util.Responses;
1011
import org.jetbrains.annotations.NotNull;
1112

@@ -18,10 +19,14 @@
1819
public abstract class ConfigSubcommand extends SlashCommand.Subcommand {
1920
@Override
2021
public void execute(@NotNull SlashCommandInteractionEvent event) {
21-
if (event.getGuild() == null) {
22+
if (event.getGuild() == null || event.getMember() == null) {
2223
Responses.replyGuildOnly(event).queue();
2324
return;
2425
}
26+
if (!Checks.hasAdminRole(event.getGuild(), event.getMember())) {
27+
Responses.replyAdminOnly(event, event.getGuild()).queue();
28+
return;
29+
}
2530
try {
2631
handleConfigSubcommand(event, Bot.config.get(event.getGuild())).queue();
2732
} catch (UnknownPropertyException e) {

0 commit comments

Comments
 (0)