Revert quick fix

This commit is contained in:
Nick 2024-06-27 21:24:55 -05:00
parent d088e2bf95
commit 3af151d89a

@ -1,10 +1,7 @@
package cc.fascinated.bat.service; package cc.fascinated.bat.service;
import cc.fascinated.bat.Consts; import cc.fascinated.bat.Consts;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.*;
import cc.fascinated.bat.command.BatCommandExecutor;
import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
@ -78,10 +75,10 @@ public class CommandService extends ListenerAdapter {
// Unregister all commands that Discord has but we don't // Unregister all commands that Discord has but we don't
jda.retrieveCommands().complete().forEach(command -> { jda.retrieveCommands().complete().forEach(command -> {
BatCommand batCommand = commands.get(command.getName()); CommandInfo commandInfo = commands.get(command.getName()).getCommandInfo();
if (batCommand == null) { if (commands.containsKey(command.getName()) && (commandInfo.category().isHidden() || commandInfo.botOwnerOnly())) {
jda.deleteCommandById(command.getId()).complete(); // Unregister the command on Discord jda.deleteCommandById(command.getId()).complete(); // Unregister the command on Discord
log.info("Unregistered unknown command \"{}\" from Discord", command.getName()); log.info("Unregistered hidden command \"{}\" from Discord", command.getName());
return; return;
} }
if (commands.containsKey(command.getName())) { if (commands.containsKey(command.getName())) {
@ -211,4 +208,4 @@ public class CommandService extends ListenerAdapter {
.queue(); .queue();
} }
} }
} }