package stream.flarebot.flarebot.commands.moderation.mod;

import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.entities.User;
import stream.flarebot.flarebot.commands.Command;
import stream.flarebot.flarebot.commands.CommandType;
import stream.flarebot.flarebot.objects.GuildWrapper;
import stream.flarebot.flarebot.util.GeneralUtils;
import stream.flarebot.flarebot.util.MessageUtils;

import java.awt.Color;

public class WarnCommand implements Command {

    @Override
    public void onCommand(User sender, GuildWrapper guild, TextChannel channel, Message message, String[] args, Member member) {
        if (args.length == 0) {
            MessageUtils.sendUsage(this, channel, sender);
        } else {
            User user = GeneralUtils.getUser(args[0]);
            if (user == null) {
                MessageUtils.sendErrorMessage("We couldn't find that user!!", channel);
                return;
            }
            String reason = null;
            if(args.length >= 2) reason = MessageUtils.getMessage(args, 1);
            guild.addWarning(user, reason);
            EmbedBuilder eb = new EmbedBuilder();
            eb.appendDescription("You have been warned in the `" + guild.getGuild().getName() + "(" + guild.getGuildId() + ")` guild");
            eb.addField("Reason", "```" + reason + "```", false);
            eb.addField("Your total warnings", String.valueOf(guild.getUserWarnings(user).size()), true);
            eb.setColor(Color.CYAN);
            MessageUtils.sendPM(channel, user, eb);
        }
    }

    @Override
    public String getCommand() {
        return "warn";
    }

    @Override
    public String getDescription() {
        return "Warns a user";
    }

    @Override
    public String getUsage() {
        return "`{%}warn <user> <reason>` - warns a user";
    }

    @Override
    public CommandType getType() {
        return CommandType.MODERATION;
    }
}

@@ -1316,282 +1316,144 @@
 on(%22
-You have been warned in the %60%22 + guild.getGuild().getName() + %22(%22 + guild.getGuildId() + %22)%60 guild%22);%0A            eb.addField(%22Reason%22, %22%60%60%60%22 + reason + %22%60%60%60%22, false);%0A            eb.addField(%22Your total warnings%22, String.valueOf(guild.getUserWarnings(user).size()), true);%0A
+%5Cu26A0 Warned %22 + MessageUtils.getTag(user) %0A                    + (reason != null ? %22(%60%22 + reason.replaceAll(%22%60%22, %22'%22) + %22%60%22 : %22%22)%0A    
     
@@ -1460,18 +1460,16 @@
         
-eb
 .setColo
@@ -1480,12 +1480,13 @@
 lor.
-CYAN
+WHITE
 );%0A 
@@ -1500,45 +1500,46 @@
     
-MessageUtils.sendPM(channel, user, eb
+channel.sendMessage(eb.build()).queue(
 );%0A 
@@ -1801,16 +1801,16 @@
 er%3E 
-%3C
+(
 reason
-%3E
+)
 %60 - 

Move warn out of DM and updated message with usage