package me.duncte123.skybot.commands;

import me.duncte123.skybot.Command;
import me.duncte123.skybot.utils.HelpEmbeds;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class HelpCommand extends Command {

    public final static String help = "shows a list of all the commands.";

    @Override
    public boolean called(String[] args, MessageReceivedEvent event) {
        // TODO Auto-generated method stub
        return true;
    }

    @Override
    public void action(String[] args, MessageReceivedEvent event) {


        event.getAuthor().openPrivateChannel().queue( (pc) -> {
            event.getTextChannel().sendMessage(event.getMember().getAsMention() +" check your DM's").queue();
            pc.sendMessage(HelpEmbeds.mainCommands).queue();
            pc.sendMessage(HelpEmbeds.musicCommands).queue();
            pc.sendMessage(HelpEmbeds.funCommands).queue();
            pc.sendMessage(HelpEmbeds.modCommands).queue();
        },
                err -> event.getChannel().sendMessage("ERROR: " + err.getMessage()).queue() );
    }

    @Override
    public String help() {
        // TODO Auto-generated method stub
        return help;
    }
}

@@ -113,16 +113,66 @@
 Embeds;%0A
+import net.dv8tion.jda.core.entities.TextChannel;%0A
 import n
@@ -669,120 +669,629 @@
     
-event.getTextChannel().sendMessage(event.getMember().getAsMention() +%22 check your DM's%22).queue();%0A            pc
+pc.sendMessage(HelpEmbeds.mainCommands).queue( msg -%3E %7B%0A                        pc.sendMessage(HelpEmbeds.musicCommands).queue();%0A                        pc.sendMessage(HelpEmbeds.funCommands).queue();%0A                        pc.sendMessage(HelpEmbeds.modCommands).queue();%0A                        event.getTextChannel().sendMessage(event.getMember().getAsMention() +%22 check your DM's%22).queue();%0A                    %7D,%0A                    //When sending fails, send to the channel%0A                    err -%3E %7B%0A                        TextChannel currentChann = event.getTextChannel();%0A                        currentChann
 .sen
@@ -1337,34 +1337,56 @@
 ();%0A            
-pc
+            currentChann
 .sendMessage(Hel
@@ -1421,34 +1421,56 @@
 ();%0A            
-pc
+            currentChann
 .sendMessage(Hel
@@ -1503,34 +1503,56 @@
 ();%0A            
-pc
+            currentChann
 .sendMessage(Hel
@@ -1573,32 +1573,204 @@
 mands).queue();%0A
+                        currentChann.sendMessage(%22Message could not be delivered to dm's and has been send in this channel.%22).queue();%0A                    %7D%0A            );%0A
         %7D,%0A     
@@ -1855,16 +1855,24 @@
 .queue()
+%0A       
  );%0A    

Create failover for if the helpmessage fails to send