fix bot not loading when admin guild is null
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s
This commit is contained in:
parent
ff5b83f531
commit
e05e08c291
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user