package com.programmingwizzard.charrizard.bot.commands;

import com.programmingwizzard.charrizard.bot.commands.basic.CMessage;
import com.programmingwizzard.charrizard.bot.commands.basic.Command;
import com.programmingwizzard.charrizard.utils.CharCodes;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.exceptions.RateLimitedException;

/*
 * @author Libter
 * @date 06.02.2017
 */
public class BigTextCommand extends Command
{

    public BigTextCommand()
    {
        super("bigtext");
    }

    @Override
    public void handle(CMessage message, String[] args) throws RateLimitedException
    {
        TextChannel channel = message.getChannel();
        if (args.length == 1)
        {
            channel.sendMessage("**Correct usage**: !bigtext <text>").queue();
            return;
        }

        StringBuilder result = new StringBuilder();
        for (int i = 1; i < args.length; i++)
        {
            for (char c : args[i].toCharArray())
            {
                result.append(toRegionalIndicator(c)).append(" ");
            }
            result.append("   ");
        }
        channel.sendMessage(result.toString()).queue();
    }

    private String toRegionalIndicator(char c) {
        if (c >= CharCodes.SMALL_A && c <= CharCodes.SMALL_Z)
        {
            c -= CharCodes.SMALL_A;
            return String.valueOf(Character.toChars(CharCodes.REGIONAL_INDICATOR_A + c));
        }
        else
        {
            return "";
        }
    }

}

@@ -702,12 +702,11 @@
 gth 
-== 1
+%3C 3
 )%0A  
@@ -729,72 +729,21 @@
     
+usage(
 channel
-.sendMessage(%22**Correct usage**: !bigtext %3Ctext%3E%22).queue(
 );%0A 
@@ -820,24 +820,139 @@
 gBuilder();%0A
+        String action = args%5B1%5D;%0A        switch (action.toLowerCase())%0A        %7B%0A            case %22print%22:%0A        
         for 
@@ -960,17 +960,17 @@
 int i = 
-1
+2
 ; i %3C ar
@@ -985,34 +985,48 @@
 h; i++)%0A        
-%7B%0A
+        %7B%0A      
             for 
@@ -1017,24 +1017,26 @@
             
+  
 for (char c 
@@ -1045,16 +1045,30 @@
 args%5Bi%5D.
+toLowerCase().
 toCharAr
@@ -1078,34 +1078,50 @@
 ())%0A            
-%7B%0A
+        %7B%0A        
                 
@@ -1175,34 +1175,45 @@
 %22);%0A            
-%7D%0A
+        %7D%0A   
             resu
@@ -1200,32 +1200,37 @@
 %0A               
+     
 result.append(%22 
@@ -1243,26 +1243,36 @@
         
-%7D%0A
+        %7D%0A  
         
 channel.
@@ -1263,16 +1263,22 @@
         
+      
 channel.
@@ -1313,24 +1313,749 @@
 )).queue();%0A
+                break;%0A            case %22raw%22:%0A                result.append(%22%60%60%60%22);%0A                for (int i = 2; i %3C args.length; i++)%0A                %7B%0A                    for (char c : args%5Bi%5D.toLowerCase().toCharArray())%0A                    %7B%0A                        if (!toRegionalIndicator(c).isEmpty())%0A                        %7B%0A                            result.append(%22:regional_indicator_%22).append(c).append(%22: %22);%0A                        %7D%0A                    %7D%0A                    result.append(%22   %22);%0A                %7D%0A                result.append(%22%60%60%60%22);%0A                channel.sendMessage(result.toString()).queue();%0A                break;%0A            default:%0A                usage(channel);%0A        %7D%0A
     %7D%0A%0A    p
@@ -2095,16 +2095,20 @@
 (char c)
+%0A   
  %7B%0A     
@@ -2373,10 +2373,154 @@
 %0A    %7D%0A%0A
+    private void usage(TextChannel channel)%0A    %7B%0A        channel.sendMessage(%22**Correct usage**: !bigtext %3Cprint%7Craw%3E %3Ctext%3E%22).queue();%0A    %7D%0A%0A
 %7D%0A

Add raw subcommand to !bigtext