Skip to content

Commit d3b5e93

Browse files
committed
Fine tuned logs for reload registration
as discussed in CR
1 parent 74e77e9 commit d3b5e93

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

application/src/main/java/org/togetherjava/tjbot/commands/system/CommandSystem.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public void onReady(@NotNull ReadyEvent event) {
7676
// Register reload on all guilds
7777
logger.debug("JDA is ready, registering reload command");
7878
event.getJDA().getGuildCache().forEach(this::registerReloadCommand);
79+
// NOTE We do not have to wait for reload to complete for the command system to be ready
80+
// itself
7981
logger.debug("Command system is now ready");
8082
}
8183

@@ -104,12 +106,16 @@ private void registerReloadCommand(@NotNull Guild guild) {
104106
guild.retrieveCommands().queue(commands -> {
105107
// Has it been registered already?
106108
if (commands.stream().map(Command::getName).anyMatch(RELOAD_COMMAND::equals)) {
109+
logger.debug("Command '{}' has already been registered for guild '{}'",
110+
RELOAD_COMMAND, guild.getName());
107111
return;
108112
}
109113

110114
logger.debug("Register '{}' for guild '{}'", RELOAD_COMMAND, guild.getName());
111115
SlashCommand reloadCommand = requireSlashCommand(RELOAD_COMMAND);
112-
guild.upsertCommand(reloadCommand.getData()).queue();
116+
guild.upsertCommand(reloadCommand.getData())
117+
.queue(command -> logger.debug("Registered '{}' for guild '{}'", RELOAD_COMMAND,
118+
guild.getName()));
113119
});
114120
}
115121

0 commit comments

Comments
 (0)