From 45755503a7bb6ee5353266d9f7ac108aab018a99 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 2 Jul 2024 20:04:27 +0100 Subject: [PATCH] show account age on member join log --- .../features/base/commands/server/PremiumCommand.java | 2 +- .../bat/features/logging/listeners/MemberListener.java | 9 ++++----- .../bat/features/namehistory/command/UserSubCommand.java | 2 +- .../scoresaber/command/scoresaber/ScoreSaberCommand.java | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java index 544357f..ff257e5 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java @@ -26,7 +26,7 @@ public class PremiumCommand extends BatCommand { EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information"); if (premium.hasPremium()) { embed.addField("Premium", premium.hasPremium() ? "Yes" : "No", true); - embed.addField("Started", "".formatted(premium.getActivatedAt().toInstant().toEpochMilli() / 1000), true); + embed.addField("Started", "".formatted(premium.getActivatedAt().toInstant().getEpochSecond()), true); embed.addField("Expires", premium.isInfinite() ? "Never" : "" .formatted(premium.getExpiresAt().toInstant().toEpochMilli() / 1000), true); } else { diff --git a/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java b/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java index 104090d..a9c19dc 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java +++ b/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java @@ -44,7 +44,7 @@ public class MemberListener implements EventListener { .setDescription(new EmbedDescriptionBuilder("Member Joined") .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) .appendLine("Username: %s".formatted(user.getDiscordUser().getName()), true) - .appendLine("Snowflake: %s".formatted(user.getId()), true) + .appendLine("Account Age: ".formatted(user.getDiscordUser().getTimeCreated().toEpochSecond()), true) .build()) .build()); } @@ -57,7 +57,6 @@ public class MemberListener implements EventListener { .setDescription(new EmbedDescriptionBuilder("Member Left") .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) .appendLine("Username: %s".formatted(user.getDiscordUser().getName()), true) - .appendLine("Snowflake: %s".formatted(user.getId()), true) .build()) .build()); } @@ -138,12 +137,12 @@ public class MemberListener implements EventListener { OffsetDateTime timeoutEnd = event.getNewTimeOutEnd(); if (user.getDiscordUser().isBot() || timeoutEnd == null) return; - long millis = timeoutEnd.toInstant().toEpochMilli() / 1000; + long seconds = timeoutEnd.toInstant().getEpochSecond(); logFeature.sendLog(guild, LogType.MEMBER_TIMEOUT, EmbedUtils.errorEmbed() .setDescription(new EmbedDescriptionBuilder("Member Timed Out") .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) - .appendLine("Timeout End: ".formatted(millis), true) - .appendLine("Relative: ".formatted(millis), true) + .appendLine("Timeout End: ".formatted(seconds), true) + .appendLine("Relative End: ".formatted(seconds), true) .build()) .build()); } diff --git a/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java index 27143ca..553fd12 100644 --- a/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java @@ -46,7 +46,7 @@ public class UserSubCommand extends BatSubCommand { builder.append("%s has no name history".formatted(target.getDiscordUser().getAsMention())); } else { for (TrackedName trackedName : profile.getNameHistorySorted()) { - builder.append("`%s` - \n".formatted(trackedName.getName(), trackedName.getChangedDate().toInstant().toEpochMilli()/1000)); + builder.append("`%s` - \n".formatted(trackedName.getName(), trackedName.getChangedDate().toInstant().getEpochSecond())); } } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java index 2126b38..e0adcf1 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java @@ -87,7 +87,7 @@ public class ScoreSaberCommand extends BatCommand { .addField("Rank", "#" + NumberFormatter.formatCommas(account.getRank()), true) .addField("Country Rank", "#" + NumberFormatter.formatCommas(account.getCountryRank()), true) .addField("PP", NumberFormatter.formatCommas(account.getPp()), true) - .addField("Joined", "".formatted(DateUtils.getDateFromString(account.getFirstSeen()).toInstant().toEpochMilli() / 1000), true) + .addField("Joined", "".formatted(DateUtils.getDateFromString(account.getFirstSeen()).toInstant().getEpochSecond()), true) .setTimestamp(LocalDateTime.now()) .setFooter(fetchTime > 3 ? "Fetched in %sms".formatted(fetchTime) : "Cached", "https://flagcdn.com/h120/%s.png".formatted(account.getCountry().toLowerCase())) .setColor(Colors.DEFAULT)