diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index 71c244c..6894ab1 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -102,10 +102,14 @@ public class CommandService extends ListenerAdapter { } } - Objects.requireNonNull(jda.getGuildById(Consts.ADMIN_GUILD), "Admin guild is null!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") - .updateCommands().addCommands(commands.values().stream() - .filter(command -> command.getCategory().isHidden() || command.isBotOwnerOnly()) - .map(BatCommand::getCommandData).toList()).complete(); + Guild adminGuild = jda.getGuildById(Consts.ADMIN_GUILD); + if (adminGuild != null) { + adminGuild.updateCommands().addCommands(commands.values().stream() + .filter(command -> command.getCategory().isHidden() || command.isBotOwnerOnly()) + .map(BatCommand::getCommandData).toList()).complete(); + } else { + log.error("Unable to find the admin guild to register hidden commands"); + } log.info("Registered all slash commands in {}ms", System.currentTimeMillis() - before); }