package ml.duncte123.skybot.commands.uncategorized;

import com.sedmelluq.discord.lavaplayer.tools.PlayerLibrary;
import ml.duncte123.skybot.objects.command.Command;
import ml.duncte123.skybot.utils.EmbedUtils;
import ml.duncte123.skybot.utils.Settings;
import net.dv8tion.jda.core.JDAInfo;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.MessageEmbed;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;

/**
 * Created by Duncan on 11-7-2017.
 */
public class BotinfoCommand extends Command {

    /**
     * This is the executeCommand of the command, the thing you want the command to to needs to be in here
     * @param args The command agruments
     * @param event a instance of {@link net.dv8tion.jda.core.events.message.MessageReceivedEvent MessageReceivedEvent}
     */
    @Override
    public void executeCommand(String[] args, GuildMessageReceivedEvent event) {
        User u = event.getJDA().getSelfUser();
        Member m = event.getGuild().getMemberById(u.getId());

        MessageEmbed eb = EmbedUtils.defaultEmbed()
                .setDescription("Here is some information about me \uD83D\uDE09")
                .setThumbnail(u.getEffectiveAvatarUrl())
                .addField("General info", "**Creator:** duncte123#1245\n" +
                        "**Invite:** [You can invite me by clicking here](https://bots.discord.pw/bots/210363111729790977)\n" +
                        "**Github:** [https://github.com/duncte123/SkyBot](https://github.com/duncte123/SkyBot)\n" +
                        "**Guilds:** " + event.getJDA().asBot().getShardManager().getGuildCache().size() + "\n" +
                        "**Bot version:** " + Settings.version, true)
                .addField("Lib info", "JDA version: " + JDAInfo.VERSION + "\nLavaPlayer version: " + PlayerLibrary.VERSION, false)
                .addField("Donate", "If you want to help me out and support the bot please consider to [donate](https://paypal.me/duncte123) any amount.", false)
                .build();
        sendEmbed(event, eb);
    }

    /**
     * The usage instructions of the command
     * @return a String
     */
    @Override
    public String help() {
        return "Gets some info about the bot\nUsage: `"+ Settings.prefix+getName()+"`";
    }

    @Override
    public String getName() {
        return "botinfo";
    }

    @Override
    public String[] getAliases() {
        return new String[]{"about"};
    }
}

@@ -107,16 +107,65 @@
 ibrary;%0A
+import com.sun.management.OperatingSystemMXBean;%0A
 import m
@@ -208,16 +208,16 @@
 ommand;%0A
-
 import m
@@ -337,53 +337,8 @@
 fo;%0A
-import net.dv8tion.jda.core.entities.Member;%0A
 impo
@@ -504,16 +504,118 @@
 Event;%0A%0A
+import java.lang.management.ManagementFactory;%0Aimport java.sql.Time;%0Aimport java.text.DecimalFormat;%0A%0A
 /**%0A * C
@@ -1122,24 +1122,25 @@
 User();%0A
+%0A
         
 Member m
@@ -1135,59 +1135,966 @@
     
-Member m = event.getGuild().getMemberById(u.getId()
+String OS = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getName();%0A        OS = OS + %22 %22 + ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getArch() + %22 %22 + ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getVersion();%0A        String cpu0 = new DecimalFormat(%22###.###%25%22).format(ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getProcessCpuLoad());%0A        String cpu2 = new DecimalFormat(%22###.###%25%22).format(ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getSystemCpuLoad());%0A        int cpu1 = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();%0A        long ram0 = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1000000;%0A        long ram1 = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() / 1000000;%0A        long up = ManagementFactory.getRuntimeMXBean().getUptime();%0A        Time upp = new Time(up - 3600000
 );%0A%0A
@@ -2715,24 +2715,24 @@
 () + %22%5Cn%22 +%0A
-
             
@@ -2789,16 +2789,328 @@
 , true)%0A
+                .addField(%22System info%22, %22**Operating System:** %22 + OS + %22%5Cn%22 +%0A                        %22**Uptime:** %22 + upp.toString() + %22%5Cn%22 +%0A                        %22**Ram:** %22  + ram0 +%22MB/%22 + ram1 + %22MB%5Cn%22 +%0A                        %22**CPU Usage:** %22 + cpu0 + %22 / %22 + cpu2 + %22 (%22 + cpu1 +%22 Cores)%22 , false)%0A
         

Add system info to BotinfoCommand