make the scoresaber main cmd show more data

This commit is contained in:
Lee
2024-06-24 14:21:51 +01:00
parent 0b176c3b2a
commit 82e241f6ac
9 changed files with 33 additions and 31 deletions

View File

@ -1,7 +1,6 @@
package cc.fascinated.bat.command.impl.global.beatsaber.scoresaber;
import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.common.Profile;
import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.beatsaber.scoresaber.ScoreSaberAccountToken;
import cc.fascinated.bat.model.user.BatUser;
@ -16,8 +15,6 @@ import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author Fascinated (fascinated7)
*/

View File

@ -1,13 +1,13 @@
package cc.fascinated.bat.command.impl.global.beatsaber.scoresaber;
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.common.DateUtils;
import cc.fascinated.bat.common.NumberUtils;
import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.beatsaber.scoresaber.ScoreSaberAccountToken;
import cc.fascinated.bat.model.user.BatUser;
import cc.fascinated.bat.model.user.profiles.ScoreSaberProfile;
import cc.fascinated.bat.service.GuildService;
import cc.fascinated.bat.service.ScoreSaberService;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;
@ -21,6 +21,8 @@ import net.dv8tion.jda.internal.interactions.CommandDataImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* @author Fascinated (fascinated7)
*/
@ -31,6 +33,7 @@ public class ScoreSaberCommand extends BatCommand {
@Autowired
public ScoreSaberCommand(@NonNull ScoreSaberService scoreSaberService) {
super("scoresaber");
super.setCategory(Category.BEAT_SABER);
this.scoreSaberService = scoreSaberService;
super.setDescription("View a user's ScoreSaber profile");
@ -66,7 +69,15 @@ public class ScoreSaberCommand extends BatCommand {
*/
public static MessageEmbed buildProfileEmbed(ScoreSaberAccountToken account) {
return new EmbedBuilder()
.setAuthor(account.getName() + "'s Profile", "https://scoresaber.com/u/%s".formatted(account.getId()),
"https://cdn.scoresaber.com/avatars/%s.jpg".formatted(account.getId()))
.addField("Name", account.getName(), true)
.addField("Country", account.getCountry(), true)
.addField("Rank", "#" + account.getRank(), true)
.addField("Country Rank", "#" + account.getCountryRank(), true)
.addField("PP", NumberUtils.formatNumberCommas(account.getPp()), true)
.addField("Joined", "<t:%s>".formatted(DateUtils.getDateFromString(account.getFirstSeen()).toInstant().toEpochMilli()/1000), true)
.setTimestamp(LocalDateTime.now())
.build();
}
}

View File

@ -3,8 +3,6 @@ package cc.fascinated.bat.command.impl.global.beatsaber.scoresaber;
import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.user.BatUser;
import cc.fascinated.bat.service.GuildService;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;