= Updated stats formatting
This commit is contained in:
@@ -3,7 +3,9 @@ package commands;
|
||||
import core.Command;
|
||||
import core.LocStrings;
|
||||
import core.CommandManager.ThreadData;
|
||||
import core.Config;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyEmbed;
|
||||
import dataStructures.KittyGuild;
|
||||
import dataStructures.KittyRating;
|
||||
import dataStructures.KittyRole;
|
||||
@@ -23,25 +25,30 @@ public class CommandStats extends Command
|
||||
@Override
|
||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
String out = "```\n";
|
||||
// Variables
|
||||
Stats stats = Stats.instance;
|
||||
|
||||
String out = "";
|
||||
long seen = stats.GetMessagesSeen();
|
||||
long processed = stats.GetCommandsProcessed();
|
||||
|
||||
out += "----- [General] -----\n";
|
||||
// General
|
||||
out += "General";
|
||||
out += "```\n";
|
||||
out += " Messages observed: " + seen + "\n";
|
||||
out += "Commands processed: " + processed + "\n";
|
||||
out += " Command invoke %: " + ((int)((processed / (float)seen) * 1000)) / 10.0f + "%\n";
|
||||
out += " KittyBot uptime: " + stats.GetFormattedUptime() + "\n";
|
||||
out += "\n";
|
||||
out += "----- [Health] -----\n";
|
||||
out += " Bot uptime: " + stats.GetFormattedUptime() + "\n";
|
||||
out += "```\n";
|
||||
|
||||
// Health
|
||||
out += "Health";
|
||||
out += "```\n";
|
||||
out += " SMT cores: " + stats.GetCPUAvailable() + "\n";
|
||||
|
||||
// If CPU load works on this OS, list it.
|
||||
// If CPU load works on this OS, list it. -1.0 is the error state
|
||||
double CPULoad = stats.GetSystemCPULoad();
|
||||
if(CPULoad > -0.9) // -1.0 is the error state
|
||||
out += "System CPU Load: " + (CPULoad * 100) + "%\n";
|
||||
out += CPULoad > -0.9
|
||||
? " CPU Load: " + (CPULoad * 100) + "%\n" : "";
|
||||
|
||||
ThreadData data = stats.GetThreadData();
|
||||
Integer terminated = data.states.get(Thread.State.TERMINATED);
|
||||
@@ -58,12 +65,18 @@ public class CommandStats extends Command
|
||||
+ " term-" + (terminated == null ? 0 : terminated)
|
||||
+ "\n";
|
||||
|
||||
out += "```\n";
|
||||
|
||||
|
||||
// Cache
|
||||
Integer guildCount = stats.GetGuildCount();
|
||||
Integer userCount = stats.GetUserCount();
|
||||
|
||||
out += "\n----- [Cache] -----\n"
|
||||
out += "Cache";
|
||||
out += "```\n"
|
||||
+ "Cached Guilds: " + guildCount + "\n"
|
||||
+ " Cached Users: " + userCount;
|
||||
|
||||
out += "\n```";
|
||||
|
||||
KittyEmbed embed = new KittyEmbed();
|
||||
|
||||
Reference in New Issue
Block a user