package com.techcavern.wavetact.ircCommands.utils;

import com.techcavern.wavetact.annot.IRCCMD;
import com.techcavern.wavetact.objects.IRCCommand;
import com.techcavern.wavetact.utils.ErrorUtils;
import com.techcavern.wavetact.utils.GeneralUtils;
import com.techcavern.wavetact.utils.IRCUtils;
import org.apache.commons.lang3.StringUtils;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;

import java.util.Arrays;

@IRCCMD
public class Help extends IRCCommand {

    public Help() {
        super(GeneralUtils.toArray("help halp"), 0, "help (command)", "Gets help on a command - generally a + before something means editing it, and a - means removing it. None means adding it. Time is in [time](s/m/h/d/w) format", false);
    }

    @Override
    public void onCommand(String command, User user, PircBotX network, String prefix, Channel channel, boolean isPrivate, int userPermLevel, String... args) throws Exception {
        if (args.length > 0) {
            if (args[0].equalsIgnoreCase("permissions")) {
                IRCUtils.sendMessage(user, network, channel, "0 = Everyone, 5 = Voiced/Trusted, 7 = Half-Opped, 10 = Opped & Protected, 15 = Ownered, 18 = Network Admin,  9001 = Controller ", prefix);
            } else {
                IRCCommand irCommand = IRCUtils.getGenericCommand(args[0]);
                if (irCommand != null) {
                    IRCUtils.sendMessage(user, network, channel, "Variations: " + StringUtils.join(Arrays.asList(irCommand.getCommandID()), ", "), prefix);
                    String syntax = irCommand.getSyntax();
                    if (!syntax.isEmpty())
                        IRCUtils.sendMessage(user, network, channel, "Syntax: " + syntax, prefix);
                    IRCUtils.sendMessage(user, network, channel, irCommand.getDesc(), prefix);
                } else {
                    ErrorUtils.sendError(user, "Command does not exist");
                }
            }
        } else {
            IRCUtils.sendMessage(user, network, channel, "help [command] - generally a + before something means editing it, and a - means removing it. None means adding it. - Time is in [time](s/m/h/d/w) format", prefix);
        }
    }
}

@@ -2189,16 +2189,72 @@
 ) format
+. %5B%5D is a required argument. () is an optional argument.
 %22, prefi

Change help command a bit