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

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;

public class UnmuteCommand implements Command {

    @Override
    public void onCommand(User sender, GuildWrapper guild, TextChannel channel, Message message, String[] args, Member member) {
        if (args.length != 1) {
            MessageUtils.sendUsage(this, channel, sender, args);
        } else {
            User user = GeneralUtils.getUser(args[0], guild.getGuildId());
            if (user == null) {
                MessageUtils.sendErrorMessage("Invalid user!!", channel);
                return;
            }
            if (guild.getMutedRole() == null) {
                MessageUtils.sendErrorMessage("Error getting the \"Muted\" role! Check FlareBot has permissions to create it!", channel);
            }
        }
    }

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

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

    @Override
    public String getUsage() {
        return "`{%}unmute <user>` - Unmutes a user.";
    }

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

@@ -340,16 +340,128 @@
 ndType;%0A
+import stream.flarebot.flarebot.mod.modlog.ModAction;%0Aimport stream.flarebot.flarebot.mod.modlog.ModlogHandler;%0A
 import s
@@ -825,17 +825,17 @@
 .length 
-!
+%3E
 = 1) %7B%0A 
@@ -849,99 +849,19 @@
     
-MessageUtils.sendUsage(this, channel, sender, args);%0A        %7D else %7B%0A            User user
+User target
  = G
@@ -891,28 +891,8 @@
 s%5B0%5D
-, guild.getGuildId()
 );%0A 
@@ -906,20 +906,22 @@
     if (
-user
+target
  == null
@@ -975,22 +975,69 @@
 ge(%22
-Invalid user!!
+We cannot find that user! Try their ID if you didn't already.
 %22, c
@@ -1034,32 +1034,40 @@
 ready.%22, channel
+, sender
 );%0A             
@@ -1107,43 +1107,63 @@
     
-if (guild.getMutedRole() == null) %7B
+String reason = null;%0A            if (args.length %3E= 2)
 %0A   
@@ -1166,32 +1166,41 @@
 %0A               
+ reason =
  MessageUtils.se
@@ -1201,130 +1201,223 @@
 ils.
-sendErrorMessage(%22Error getting the %5C%22Muted%5C%22 role! Check FlareBot has permissions to create it!%22, channel);%0A            %7D
+getMessage(args, 1);%0A%0A            ModlogHandler.getInstance().handleAction(guild, channel, sender, target, ModAction.UNMUTE, reason);%0A        %7D else %7B%0A            MessageUtils.sendUsage(this, channel, sender, args);
 %0A   

Make unmute actually like... unmute