package com.nincraft.ninbot.components.info;

import com.nincraft.ninbot.components.command.AbstractCommand;
import com.nincraft.ninbot.components.command.CommandResult;
import com.nincraft.ninbot.components.config.component.ComponentService;
import lombok.val;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;

import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class HelpCommand extends AbstractCommand {

    private Map<String, AbstractCommand> commandMap;
    private ComponentService componentService;

    public HelpCommand(Map<String, AbstractCommand> commandMap,
            ComponentService componentService) {
        length = 2;
        name = "help";
        this.commandMap = commandMap;
        this.componentService = componentService;
    }

    @Override
    public CommandResult executeCommand(MessageReceivedEvent event) {
        CommandResult commandResult = new CommandResult(event);
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setTitle(resourceBundle.getString("command.help.message.title"))
                .setColor(Color.BLUE);
        List<String> keyList = new ArrayList<>(commandMap.keySet());
        Collections.sort(keyList);
        keyList.stream()
                .filter(commandName -> userHasPermission(event.getGuild(), event.getAuthor(),
                        commandMap.get(commandName)
                                .getPermissionLevel()))
                .filter(commandName -> !componentService.isDisabled(commandName, event.getGuild().getId()))
                .forEach(commandName -> {
                    val command = commandMap.get(commandName);
                    command.setResourceBundle(resourceBundle);
                    embedBuilder.addField(commandName, command.getCommandDescription(commandName), false);
                });
        embedBuilder.setFooter(resourceBundle.getString("command.help.message.footer"), null);
        commandResult.addPrivateMessageAction(embedBuilder.build())
                .addSuccessfulReaction();
        return commandResult;
    }
}

@@ -236,16 +236,51 @@
 ervice;%0A
+import lombok.extern.log4j.Log4j2;%0A
 import l
@@ -432,21 +432,16 @@
 va.util.
-Array
 List;%0Aim
@@ -459,66 +459,19 @@
 til.
-Collections;%0Aimport java.util.List;%0Aimport java.util.Map;%0A
+*;%0A%0A@Log4j2
 %0Apub
@@ -1803,24 +1803,54 @@
 rceBundle);%0A
+                    try %7B%0A    
             
@@ -1940,24 +1940,206 @@
 e), false);%0A
+                    %7D catch (MissingResourceException e) %7B%0A                        log.error(%22Missing command description text for command %22 + commandName, e);%0A                    %7D%0A
             

Add logging to help command