src/main/java/me/evyn/bot/commands/info/UserInfo.java
@Override
    public void run(MessageReceivedEvent event, String prefix, boolean embed, String[] args) {

        User bot = event.getJDA().getSelfUser();

        // if command is not ran in guild, send error and return
        if (!event.isFromType(ChannelType.TEXT)) {
            EmbedBuilder eb = EmbedCreator.newErrorEmbedMessage(bot, "This command can only be ran in servers");

            event.getChannel()
                    .sendMessage(eb.build())
                    .queue();
            return;
        }

        Member member;
        User user;

        // no arguments are present
        if (args.length == 0) {
            member = event.getMember();
            user = member.getUser();
        } else {
            // get Id from argument
            String Id = args[0].replaceAll("[^0-9.]", "");

            // attempt to find user with Id
            try {
                RestAction<Member> tempMember = event.getGuild().retrieveMemberById(Id);
                member = tempMember.complete();
                user = member.getUser();
            } catch (IllegalArgumentException | ErrorResponseException e) {
                // user could not be found
                String desc = "That ID is either invalid or the user provided is not in the server.";
                if (embed) {
                    EmbedBuilder eb = EmbedCreator.newErrorEmbedMessage(bot, desc);
                    event.getChannel()
                            .sendMessage(eb.build())
                            .queue();
                } else {
                    event.getChannel()
                            .sendMessage("ERROR: " + desc)
                            .queue();
                }
                return;
            }
        }

        // create date time for user join and register date
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd, yyyy hh:mm a");
        LocalDateTime registerTimeCreated = user.getTimeCreated().toLocalDateTime();
        LocalDateTime joinTimeCreated = member.getTimeJoined().toLocalDateTime();

        String registerDate = formatter.format(registerTimeCreated);
        String joinDate = formatter.format(joinTimeCreated);

        // find and format roles
        StringBuilder roles = new StringBuilder();

        if (member.getRoles().size() > 0) {
            member.getRoles().stream()
                    .map(role -> role.getName())
                    .forEach(role -> roles.append(role).append(", "));
            roles.delete(roles.length() - 2, roles.length() - 1);
        } else {
            roles.append("none");
        }


        if (embed) {
            EmbedBuilder eb = EmbedCreator.newCommandEmbedMessage(bot);

            eb.setTitle(user.getAsTag())
                    .setThumbnail(user.getAvatarUrl())
                    .addField("ID", user.getId(), true)
                    .addField("Bot", String.valueOf(user.isBot()), true)
                    .addField("Joined", joinDate, true)
                    .addField("Registered", registerDate, false)
                    .addField("Roles (" + member.getRoles().size() + ")", roles.toString(), true);

            // send embed
            event.getTextChannel()
                    .sendMessage(eb.build())
                    .queue();
        } else {
            event.getChannel()
                    .sendMessage("**User: **" + user.getAsTag() + "\n\n" + "**ID:** " + user.getId() + "\n" +
                            "**Bot:** " + user.isBot() + "\n" + "**Joined:** " + joinDate + "\n" + "**Registered:** " +
                            registerDate + "\n" + "**Roles (" + member.getRoles().size() + "):** " + roles.toString())
                    .queue();
        }
    }
/**
     * If ran in guild, provides information on user account
     * @param event Discord API message event
     * @param prefix Specific guild bot prefix
     * @param embed Guild embed setting
     * @param args Command arguments
     */
If ran in guild, provides information on user account
@param event Discord API message event
@param prefix Specific guild bot prefix
@param embed Guild embed setting
@param args Command arguments
If ran in guild provides information on user account @param event Discord API message event @param prefix Specific guild bot prefix @param embed Guild embed setting @param args Command arguments
@Override
    public void run(MessageReceivedEvent event, String prefix, boolean embed, String[] args) {
        User bot = event.getJDA().getSelfUser();
        if (!event.isFromType(ChannelType.TEXT)) {
            EmbedBuilder eb = EmbedCreator.newErrorEmbedMessage(bot, "This command can only be ran in servers");
            event.getChannel()
                    .sendMessage(eb.build())
                    .queue();
            return;
        }
        Member member;
        User user;
        if (args.length == 0) {
            member = event.getMember();
            user = member.getUser();
        } else {
            String Id = args[0].replaceAll("[^0-9.]", "");
            try {
                RestAction<Member> tempMember = event.getGuild().retrieveMemberById(Id);
                member = tempMember.complete();
                user = member.getUser();
            } catch (IllegalArgumentException | ErrorResponseException e) {
                String desc = "That ID is either invalid or the user provided is not in the server.";
                if (embed) {
                    EmbedBuilder eb = EmbedCreator.newErrorEmbedMessage(bot, desc);
                    event.getChannel()
                            .sendMessage(eb.build())
                            .queue();
                } else {
                    event.getChannel()
                            .sendMessage("ERROR: " + desc)
                            .queue();
                }
                return;
            }
        }
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd, yyyy hh:mm a");
        LocalDateTime registerTimeCreated = user.getTimeCreated().toLocalDateTime();
        LocalDateTime joinTimeCreated = member.getTimeJoined().toLocalDateTime();
        String registerDate = formatter.format(registerTimeCreated);
        String joinDate = formatter.format(joinTimeCreated);
        StringBuilder roles = new StringBuilder();
        if (member.getRoles().size() > 0) {
            member.getRoles().stream()
                    .map(role -> role.getName())
                    .forEach(role -> roles.append(role).append(", "));
            roles.delete(roles.length() - 2, roles.length() - 1);
        } else {
            roles.append("none");
        }
        if (embed) {
            EmbedBuilder eb = EmbedCreator.newCommandEmbedMessage(bot);
            eb.setTitle(user.getAsTag())
                    .setThumbnail(user.getAvatarUrl())
                    .addField("ID", user.getId(), true)
                    .addField("Bot", String.valueOf(user.isBot()), true)
                    .addField("Joined", joinDate, true)
                    .addField("Registered", registerDate, false)
                    .addField("Roles (" + member.getRoles().size() + ")", roles.toString(), true);
            event.getTextChannel()
                    .sendMessage(eb.build())
                    .queue();
        } else {
            event.getChannel()
                    .sendMessage("**User: **" + user.getAsTag() + "\n\n" + "**ID:** " + user.getId() + "\n" +
                            "**Bot:** " + user.isBot() + "\n" + "**Joined:** " + joinDate + "\n" + "**Registered:** " +
                            registerDate + "\n" + "**Roles (" + member.getRoles().size() + "):** " + roles.toString())
                    .queue();
        }
    }
@ Override public void run ( MessageReceivedEvent event , String prefix , boolean embed , String [ ] args ) { User bot = event . getJDA ( ) . getSelfUser ( ) ; if ( ! event . isFromType ( ChannelType . TEXT ) ) { EmbedBuilder eb = EmbedCreator . newErrorEmbedMessage ( bot , "This command can only be ran in servers" ) ; event . getChannel ( ) . sendMessage ( eb . build ( ) ) . queue ( ) ; return ; } Member member ; User user ; if ( args . length == 0 ) { member = event . getMember ( ) ; user = member . getUser ( ) ; } else { String Id = args [ 0 ] . replaceAll ( "[^0-9.]" , "" ) ; try { RestAction < Member > tempMember = event . getGuild ( ) . retrieveMemberById ( Id ) ; member = tempMember . complete ( ) ; user = member . getUser ( ) ; } catch ( IllegalArgumentException | ErrorResponseException e ) { String desc = "That ID is either invalid or the user provided is not in the server." ; if ( embed ) { EmbedBuilder eb = EmbedCreator . newErrorEmbedMessage ( bot , desc ) ; event . getChannel ( ) . sendMessage ( eb . build ( ) ) . queue ( ) ; } else { event . getChannel ( ) . sendMessage ( "ERROR: " + desc ) . queue ( ) ; } return ; } } DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "MMM dd, yyyy hh:mm a" ) ; LocalDateTime registerTimeCreated = user . getTimeCreated ( ) . toLocalDateTime ( ) ; LocalDateTime joinTimeCreated = member . getTimeJoined ( ) . toLocalDateTime ( ) ; String registerDate = formatter . format ( registerTimeCreated ) ; String joinDate = formatter . format ( joinTimeCreated ) ; StringBuilder roles = new StringBuilder ( ) ; if ( member . getRoles ( ) . size ( ) > 0 ) { member . getRoles ( ) . stream ( ) . map ( role -> role . getName ( ) ) . forEach ( role -> roles . append ( role ) . append ( ", " ) ) ; roles . delete ( roles . length ( ) - 2 , roles . length ( ) - 1 ) ; } else { roles . append ( "none" ) ; } if ( embed ) { EmbedBuilder eb = EmbedCreator . newCommandEmbedMessage ( bot ) ; eb . setTitle ( user . getAsTag ( ) ) . setThumbnail ( user . getAvatarUrl ( ) ) . addField ( "ID" , user . getId ( ) , true ) . addField ( "Bot" , String . valueOf ( user . isBot ( ) ) , true ) . addField ( "Joined" , joinDate , true ) . addField ( "Registered" , registerDate , false ) . addField ( "Roles (" + member . getRoles ( ) . size ( ) + ")" , roles . toString ( ) , true ) ; event . getTextChannel ( ) . sendMessage ( eb . build ( ) ) . queue ( ) ; } else { event . getChannel ( ) . sendMessage ( "**User: **" + user . getAsTag ( ) + "\n\n" + "**ID:** " + user . getId ( ) + "\n" + "**Bot:** " + user . isBot ( ) + "\n" + "**Joined:** " + joinDate + "\n" + "**Registered:** " + registerDate + "\n" + "**Roles (" + member . getRoles ( ) . size ( ) + "):** " + roles . toString ( ) ) . queue ( ) ; } }
If ran in guild, provides information on user account
 @param event Discord API message event
 @param prefix Specific guild bot prefix
 @param embed Guild embed setting
 @param args Command arguments
If ran in guild provides information on user account @param event Discord API message event @param prefix Specific guild bot prefix @param embed Guild embed setting @param args Command arguments
// if command is not ran in guild, send error and return // no arguments are present // get Id from argument // attempt to find user with Id // user could not be found // create date time for user join and register date // find and format roles // send embed