master #1

Merged
Fascinated merged 13 commits from okNick/Bat:master into master 2024-06-28 17:56:18 +00:00
Showing only changes of commit 3af151d89a - Show all commits

@ -1,10 +1,7 @@
package cc.fascinated.bat.service;
import cc.fascinated.bat.Consts;
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.BatCommandExecutor;
import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.*;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.model.BatGuild;
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
jda.retrieveCommands().complete().forEach(command -> {
BatCommand batCommand = commands.get(command.getName());
if (batCommand == null) {
CommandInfo commandInfo = commands.get(command.getName()).getCommandInfo();
if (commands.containsKey(command.getName()) && (commandInfo.category().isHidden() || commandInfo.botOwnerOnly())) {
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;
}
if (commands.containsKey(command.getName())) {
@ -211,4 +208,4 @@ public class CommandService extends ListenerAdapter {
.queue();
}
}
}
}