cleanup and acc country flag to ss me and user command
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s

This commit is contained in:
Lee
2024-06-27 16:30:47 +01:00
parent 50b921c66d
commit 406d6b7164
3 changed files with 15 additions and 6 deletions

View File

@ -44,7 +44,7 @@ public class HelpCommand extends BatCommand implements EventListener {
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
String categories = "";
for (Category category : Category.values()) {
long commandCount = commandService.getCommands().values().stream().filter(command -> command.getCategory() == category).count();
long commandCount = commandService.getCommandsByCategory(category).size();
categories += "**%s** - %s Commands\n".formatted(category.getName(), commandCount);
}
@ -76,9 +76,7 @@ public class HelpCommand extends BatCommand implements EventListener {
}
String commands = "";
List<BatCommand> categoryCommands = commandService.getCommands().values().stream()
.filter(command -> command.getCategory() == category)
.toList();
List<BatCommand> categoryCommands = commandService.getCommandsByCategory(category);
if (categoryCommands.isEmpty()) {
commands = "No commands available in this category.";
} else {
@ -105,7 +103,7 @@ public class HelpCommand extends BatCommand implements EventListener {
}
event.editMessageEmbeds(EmbedUtils.genericEmbed()
.setDescription("The available commands in the **%s** category: \n\n%s".formatted(category.getName(), commands))
.setDescription("There is %S commands in the **%s** category: \n\n%s".formatted(categoryCommands.size(), category.getName(), commands))
.build()).queue();
}
}