package co.phoenixlab.discord.commands;

import co.phoenixlab.discord.MessageContext;
import co.phoenixlab.discord.api.DiscordApiClient;
import co.phoenixlab.discord.api.entities.Channel;
import co.phoenixlab.discord.api.entities.Message;
import co.phoenixlab.discord.api.entities.User;

public class CommandUtil {

    static User findUser(MessageContext context, String username) {
        Message message = context.getMessage();
        User user;
        Channel channel = context.getApiClient().getChannelById(message.getChannelId());
        //  Attempt to find the given user
        //  If the user is @mentioned, try that first
        if (message.getMentions() != null && message.getMentions().length > 0) {
            user = message.getMentions()[0];
        } else {
            user = context.getApiClient().findUser(username, channel.getParent());
        }
        //  Try matching by ID
        if (user == DiscordApiClient.NO_USER) {
            user = context.getApiClient().getUserById(username, channel.getParent());
        }
        return user;
    }
}

@@ -83,59 +83,8 @@
 xt;%0A
-import co.phoenixlab.discord.api.DiscordApiClient;%0A
 impo
@@ -738,167 +738,69 @@
     
-user = context.getApiClient().findUser(username, channel.getParent());%0A        %7D%0A        //  Try matching by ID%0A        if (user == DiscordApiClient.NO_USER) %7B
+//  Try exact match, frontal match, ID match, and fuzzy match
 %0A   
@@ -842,19 +842,16 @@
 t().
-getUserById
+findUser
 (use

Remove duplicate funct in CmdUtil.findUser()