add fetch time for scoresaber me and user command
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 39s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 39s
This commit is contained in:
parent
001ece7899
commit
ecd688310f
@ -67,6 +67,7 @@ public class ScoreSaberCommand extends BatCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
long before = System.currentTimeMillis();
|
||||||
ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getSteamId());
|
ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getSteamId());
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
if (!isSelf) {
|
if (!isSelf) {
|
||||||
@ -81,6 +82,7 @@ public class ScoreSaberCommand extends BatCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long fetchTime = System.currentTimeMillis() - before;
|
||||||
interaction.replyEmbeds(new EmbedBuilder()
|
interaction.replyEmbeds(new EmbedBuilder()
|
||||||
.setAuthor(account.getName() + "'s Profile", "https://scoresaber.com/u/%s".formatted(account.getId()),
|
.setAuthor(account.getName() + "'s Profile", "https://scoresaber.com/u/%s".formatted(account.getId()),
|
||||||
"https://cdn.scoresaber.com/avatars/%s.jpg".formatted(account.getId()))
|
"https://cdn.scoresaber.com/avatars/%s.jpg".formatted(account.getId()))
|
||||||
@ -91,6 +93,7 @@ public class ScoreSaberCommand extends BatCommand {
|
|||||||
.addField("PP", NumberUtils.formatNumberCommas(account.getPp()), true)
|
.addField("PP", NumberUtils.formatNumberCommas(account.getPp()), true)
|
||||||
.addField("Joined", "<t:%s>".formatted(DateUtils.getDateFromString(account.getFirstSeen()).toInstant().toEpochMilli() / 1000), true)
|
.addField("Joined", "<t:%s>".formatted(DateUtils.getDateFromString(account.getFirstSeen()).toInstant().toEpochMilli() / 1000), true)
|
||||||
.setTimestamp(LocalDateTime.now())
|
.setTimestamp(LocalDateTime.now())
|
||||||
|
.setFooter(fetchTime > 3 ? "Fetched in %sms".formatted(fetchTime) : "Cached", null)
|
||||||
.setColor(Colors.DEFAULT)
|
.setColor(Colors.DEFAULT)
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (RateLimitException ex) {
|
} catch (RateLimitException ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user