forked from Fascinated/Bat
fix bot not loading when admin guild is null
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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
Guild adminGuild = jda.getGuildById(Consts.ADMIN_GUILD);
|
||||||
.updateCommands().addCommands(commands.values().stream()
|
if (adminGuild != null) {
|
||||||
.filter(command -> command.getCategory().isHidden() || command.isBotOwnerOnly())
|
adminGuild.updateCommands().addCommands(commands.values().stream()
|
||||||
.map(BatCommand::getCommandData).toList()).complete();
|
.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);
|
log.info("Registered all slash commands in {}ms", System.currentTimeMillis() - before);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user