Finish uptime string generator
This commit is contained in:
parent
79c8f1a95e
commit
d2caccf080
@ -72,8 +72,33 @@ public class BotInfoCommand
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
long uptimeSeconds = ChronoUnit.SECONDS.between(Configuration.getStartupTime(), now);
|
||||
Duration uptime = Duration.ofSeconds(uptimeSeconds);
|
||||
uptime.toDaysPart() // todo
|
||||
embedBuilder.addField("Uptime", "seconds: " + uptime, true);
|
||||
long seconds = uptime.toSecondsPart();
|
||||
long minutes = uptime.toMinutesPart();
|
||||
long hours = uptime.toHoursPart();
|
||||
long days = uptime.toDays();
|
||||
|
||||
StringBuilder uptimeStringBuilder = new StringBuilder();
|
||||
if(days == 0)
|
||||
{
|
||||
if(hours == 0)
|
||||
{
|
||||
if(minutes == 0)
|
||||
{} else {
|
||||
uptimeStringBuilder.append(minutes).append("m ");
|
||||
}
|
||||
} else {
|
||||
uptimeStringBuilder.append(hours).append("h ");
|
||||
uptimeStringBuilder.append(minutes).append("m ");
|
||||
}
|
||||
} else {
|
||||
|
||||
uptimeStringBuilder.append(days).append("d ");
|
||||
uptimeStringBuilder.append(hours).append("h ");
|
||||
uptimeStringBuilder.append(minutes).append("m ");
|
||||
}
|
||||
uptimeStringBuilder.append(seconds).append("s ");
|
||||
|
||||
embedBuilder.addField("Uptime", uptimeStringBuilder.toString(), true);
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user