forked from Fascinated/Bat
cleanup
This commit is contained in:
parent
06a2584e63
commit
91ecc9882c
@ -2,7 +2,7 @@ package cc.fascinated.bat.features.scoresaber;
|
||||
|
||||
import cc.fascinated.bat.common.NumberUtils;
|
||||
import cc.fascinated.bat.event.EventListener;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildNumberOneScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.NumberOneScoreFeedProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberLeaderboardToken;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberPlayerScoreToken;
|
||||
@ -49,12 +49,12 @@ public class NumberOneScoreFeedListener implements EventListener {
|
||||
if (batGuild == null) {
|
||||
continue;
|
||||
}
|
||||
GuildNumberOneScoreFeedProfile profile = batGuild.getProfile(GuildNumberOneScoreFeedProfile.class);
|
||||
NumberOneScoreFeedProfile profile = batGuild.getProfile(NumberOneScoreFeedProfile.class);
|
||||
if (profile == null || profile.getChannelId() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TextChannel channel = profile.getAsTextChannel();
|
||||
TextChannel channel = profile.getTextChannel();
|
||||
if (channel == null) {
|
||||
log.error("Scoresaber user feed channel is null for guild {}, removing the stored channel.", guild.getId());
|
||||
profile.setChannelId(null);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cc.fascinated.bat.features.scoresaber;
|
||||
|
||||
import cc.fascinated.bat.event.EventListener;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.UserScoreFeedProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberLeaderboardToken;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberPlayerScoreToken;
|
||||
@ -36,12 +36,12 @@ public class UserScoreFeedListener implements EventListener {
|
||||
if (batGuild == null) {
|
||||
continue;
|
||||
}
|
||||
GuildUserScoreFeedProfile profile = batGuild.getProfile(GuildUserScoreFeedProfile.class);
|
||||
UserScoreFeedProfile profile = batGuild.getProfile(UserScoreFeedProfile.class);
|
||||
if (profile == null || profile.getChannelId() == null || !profile.getTrackedUsers().contains(player.getId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TextChannel channel = profile.getAsTextChannel();
|
||||
TextChannel channel = profile.getTextChannel();
|
||||
if (channel == null) {
|
||||
log.error("Scoresaber user feed channel is null for guild {}, removing the stored channel.", guild.getId());
|
||||
profile.setChannelId(null);
|
||||
|
@ -4,7 +4,7 @@ import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.common.TextChannelUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildNumberOneScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.NumberOneScoreFeedProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
@ -35,7 +35,7 @@ public class ChannelSubCommand extends BatSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
GuildNumberOneScoreFeedProfile profile = guild.getProfile(GuildNumberOneScoreFeedProfile.class);
|
||||
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
|
||||
OptionMapping option = interaction.getOption("channel");
|
||||
if (option == null) {
|
||||
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
|
||||
|
@ -3,7 +3,7 @@ package cc.fascinated.bat.features.scoresaber.command.numberone;
|
||||
import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildNumberOneScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.NumberOneScoreFeedProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
@ -29,7 +29,7 @@ public class ResetSubCommand extends BatSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
GuildNumberOneScoreFeedProfile profile = guild.getProfile(GuildNumberOneScoreFeedProfile.class);
|
||||
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
|
||||
profile.reset();
|
||||
guildService.saveGuild(guild);
|
||||
|
||||
|
@ -3,7 +3,6 @@ package cc.fascinated.bat.features.scoresaber.command.scoresaber;
|
||||
import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.UserScoreSaberProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberAccountToken;
|
||||
@ -65,7 +64,7 @@ public class LinkSubCommand extends BatSubCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
user.getProfile(UserScoreSaberProfile.class).setSteamId(id);
|
||||
user.getScoreSaberProfile().setAccountId(id);
|
||||
userService.saveUser(user);
|
||||
interaction.replyEmbeds(EmbedUtils.successEmbed()
|
||||
.setDescription("Successfully linked your [ScoreSaber](%s) profile".formatted("https://scoresaber.com/u/%s".formatted(id)))
|
||||
|
@ -3,7 +3,7 @@ package cc.fascinated.bat.features.scoresaber.command.scoresaber;
|
||||
import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.UserScoreSaberProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
@ -29,7 +29,7 @@ public class ResetSubCommand extends BatSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
UserScoreSaberProfile profile = guild.getProfile(UserScoreSaberProfile.class);
|
||||
ScoreSaberProfile profile = user.getScoreSaberProfile();
|
||||
profile.reset();
|
||||
userService.saveUser(user);
|
||||
|
||||
|
@ -7,7 +7,7 @@ import cc.fascinated.bat.common.DateUtils;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.common.NumberUtils;
|
||||
import cc.fascinated.bat.exception.RateLimitException;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.UserScoreSaberProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberAccountToken;
|
||||
@ -49,8 +49,8 @@ public class ScoreSaberCommand extends BatCommand {
|
||||
* @param interaction The interaction
|
||||
*/
|
||||
public static void sendProfileEmbed(boolean isSelf, BatUser user, ScoreSaberService scoreSaberService, SlashCommandInteraction interaction) {
|
||||
UserScoreSaberProfile profile = user.getProfile(UserScoreSaberProfile.class);
|
||||
if (profile.getSteamId() == null) {
|
||||
ScoreSaberProfile profile = user.getScoreSaberProfile();
|
||||
if (profile.getAccountId() == null) {
|
||||
if (!isSelf) {
|
||||
interaction.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention()))
|
||||
@ -64,7 +64,7 @@ public class ScoreSaberCommand extends BatCommand {
|
||||
|
||||
try {
|
||||
long before = System.currentTimeMillis();
|
||||
ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getSteamId());
|
||||
ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getAccountId());
|
||||
if (account == null) {
|
||||
if (!isSelf) {
|
||||
interaction.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -4,7 +4,7 @@ import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.common.TextChannelUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.UserScoreFeedProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
@ -35,7 +35,7 @@ public class ChannelSubCommand extends BatSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
GuildUserScoreFeedProfile profile = guild.getProfile(GuildUserScoreFeedProfile.class);
|
||||
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
|
||||
OptionMapping option = interaction.getOption("channel");
|
||||
if (option == null) {
|
||||
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
|
||||
|
@ -3,7 +3,7 @@ package cc.fascinated.bat.features.scoresaber.command.userfeed;
|
||||
import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.UserScoreFeedProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
@ -29,7 +29,7 @@ public class ResetSubCommand extends BatSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
GuildUserScoreFeedProfile profile = guild.getProfile(GuildUserScoreFeedProfile.class);
|
||||
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
|
||||
profile.reset();
|
||||
guildService.saveGuild(guild);
|
||||
|
||||
|
@ -3,8 +3,8 @@ package cc.fascinated.bat.features.scoresaber.command.userfeed;
|
||||
import cc.fascinated.bat.command.BatSubCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.UserScoreSaberProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.guild.UserScoreFeedProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
@ -37,7 +37,7 @@ public class UserSubCommand extends BatSubCommand {
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
GuildUserScoreFeedProfile profile = guild.getProfile(GuildUserScoreFeedProfile.class);
|
||||
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
|
||||
OptionMapping option = interaction.getOption("user");
|
||||
if (option == null) {
|
||||
if (profile.getTrackedUsers().isEmpty()) {
|
||||
@ -61,25 +61,28 @@ public class UserSubCommand extends BatSubCommand {
|
||||
|
||||
User target = option.getAsUser();
|
||||
BatUser targetUser = userService.getUser(target.getId());
|
||||
UserScoreSaberProfile targetProfile = targetUser.getProfile(UserScoreSaberProfile.class);
|
||||
if (targetProfile.getSteamId() == null) {
|
||||
ScoreSaberProfile targetProfile = targetUser.getScoreSaberProfile();
|
||||
if (targetProfile.getAccountId() == null) {
|
||||
interaction.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("The user you are trying to track does not have a linked ScoreSaber profile")
|
||||
.build()).queue();
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile.getTrackedUsers().contains(targetProfile.getSteamId())) {
|
||||
profile.getTrackedUsers().remove(targetProfile.getSteamId());
|
||||
interaction.replyEmbeds(EmbedUtils.successEmbed()
|
||||
.setDescription("Successfully removed %s from the feed".formatted(target.getAsMention()))
|
||||
.build()).queue();
|
||||
boolean added = false;
|
||||
if (profile.isUserTracked(targetProfile.getAccountId())) {
|
||||
profile.removeTrackedUser(targetProfile.getAccountId());
|
||||
} else {
|
||||
profile.getTrackedUsers().add(targetProfile.getSteamId());
|
||||
interaction.replyEmbeds(EmbedUtils.successEmbed()
|
||||
.setDescription("Successfully added %s to the feed".formatted(target.getAsMention()))
|
||||
.build()).queue();
|
||||
profile.addTrackedUser(targetProfile.getAccountId());
|
||||
added = true;
|
||||
}
|
||||
|
||||
interaction.replyEmbeds(EmbedUtils.successEmbed()
|
||||
.setDescription("Successfully %s %s from the feed".formatted(
|
||||
added ? "added" : "removed",
|
||||
target.getAsMention()
|
||||
))
|
||||
.build()).queue();
|
||||
guildService.saveGuild(guild);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.bat.features.scoresaber.profile;
|
||||
package cc.fascinated.bat.features.scoresaber.profile.guild;
|
||||
|
||||
import cc.fascinated.bat.common.Profile;
|
||||
import cc.fascinated.bat.service.DiscordService;
|
||||
@ -11,13 +11,13 @@ import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class GuildNumberOneScoreFeedProfile extends Profile {
|
||||
public class NumberOneScoreFeedProfile extends Profile {
|
||||
/**
|
||||
* The channel ID of the score feed
|
||||
*/
|
||||
private String channelId;
|
||||
|
||||
public GuildNumberOneScoreFeedProfile() {
|
||||
public NumberOneScoreFeedProfile() {
|
||||
super("scoresaber-number-one-score-feed");
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ public class GuildNumberOneScoreFeedProfile extends Profile {
|
||||
*
|
||||
* @return the channel as a TextChannel
|
||||
*/
|
||||
public TextChannel getAsTextChannel() {
|
||||
public TextChannel getTextChannel() {
|
||||
return DiscordService.JDA.getTextChannelById(channelId);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.bat.features.scoresaber.profile;
|
||||
package cc.fascinated.bat.features.scoresaber.profile.guild;
|
||||
|
||||
import cc.fascinated.bat.common.Profile;
|
||||
import cc.fascinated.bat.service.DiscordService;
|
||||
@ -14,7 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class GuildUserScoreFeedProfile extends Profile {
|
||||
public class UserScoreFeedProfile extends Profile {
|
||||
/**
|
||||
* The channel ID of the score feed
|
||||
*/
|
||||
@ -25,20 +25,21 @@ public class GuildUserScoreFeedProfile extends Profile {
|
||||
*/
|
||||
private List<String> trackedUsers;
|
||||
|
||||
public GuildUserScoreFeedProfile() {
|
||||
public UserScoreFeedProfile() {
|
||||
super("scoresaber-user-score-feed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tracked users
|
||||
* Checks if a user is being tracked
|
||||
*
|
||||
* @return the tracked users
|
||||
* @param userId the user ID to check
|
||||
* @return if the user is being tracked
|
||||
*/
|
||||
public List<String> getTrackedUsers() {
|
||||
public boolean isUserTracked(String userId) {
|
||||
if (this.trackedUsers == null) {
|
||||
this.trackedUsers = new ArrayList<>();
|
||||
}
|
||||
return this.trackedUsers;
|
||||
return trackedUsers.contains(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +71,7 @@ public class GuildUserScoreFeedProfile extends Profile {
|
||||
*
|
||||
* @return the channel as a TextChannel
|
||||
*/
|
||||
public TextChannel getAsTextChannel() {
|
||||
public TextChannel getTextChannel() {
|
||||
return DiscordService.JDA.getTextChannelById(channelId);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.bat.features.scoresaber.profile;
|
||||
package cc.fascinated.bat.features.scoresaber.profile.user;
|
||||
|
||||
import cc.fascinated.bat.common.Profile;
|
||||
import lombok.Getter;
|
||||
@ -9,18 +9,18 @@ import lombok.Setter;
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class UserScoreSaberProfile extends Profile {
|
||||
public class ScoreSaberProfile extends Profile {
|
||||
/**
|
||||
* The Account ID of the ScoreSaber profile
|
||||
*/
|
||||
private String steamId;
|
||||
private String accountId;
|
||||
|
||||
public UserScoreSaberProfile() {
|
||||
public ScoreSaberProfile() {
|
||||
super("scoresaber");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.steamId = null;
|
||||
this.accountId = null;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cc.fascinated.bat.model;
|
||||
|
||||
import cc.fascinated.bat.common.ProfileHolder;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
|
||||
import cc.fascinated.bat.service.DiscordService;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
@ -47,4 +48,13 @@ public class BatUser extends ProfileHolder {
|
||||
public User getDiscordUser() {
|
||||
return DiscordService.JDA.getUserById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user's ScoreSaber profile
|
||||
*
|
||||
* @return the user's ScoreSaber profile
|
||||
*/
|
||||
public ScoreSaberProfile getScoreSaberProfile() {
|
||||
return getProfile(ScoreSaberProfile.class);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import cc.fascinated.bat.common.WebRequest;
|
||||
import cc.fascinated.bat.event.EventListener;
|
||||
import cc.fascinated.bat.exception.BadRequestException;
|
||||
import cc.fascinated.bat.exception.ResourceNotFoundException;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.UserScoreSaberProfile;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.*;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.NonNull;
|
||||
@ -81,9 +81,9 @@ public class ScoreSaberService extends TextWebSocketHandler {
|
||||
* @param page The page to get the scores from.
|
||||
* @return The scores.
|
||||
*/
|
||||
public ScoreSaberScoresPageToken getPageScores(UserScoreSaberProfile profile, int page) {
|
||||
log.info("Fetching scores for account '{}' from page {}.", profile.getSteamId(), page);
|
||||
ScoreSaberScoresPageToken pageToken = WebRequest.getAsEntity(String.format(GET_PLAYER_SCORES_ENDPOINT, profile.getSteamId(), "recent", page), ScoreSaberScoresPageToken.class);
|
||||
public ScoreSaberScoresPageToken getPageScores(ScoreSaberProfile profile, int page) {
|
||||
log.info("Fetching scores for account '{}' from page {}.", profile.getAccountId(), page);
|
||||
ScoreSaberScoresPageToken pageToken = WebRequest.getAsEntity(String.format(GET_PLAYER_SCORES_ENDPOINT, profile.getAccountId(), "recent", page), ScoreSaberScoresPageToken.class);
|
||||
if (pageToken == null) { // Check if the page doesn't exist.
|
||||
return null;
|
||||
}
|
||||
@ -100,11 +100,11 @@ public class ScoreSaberService extends TextWebSocketHandler {
|
||||
* @param profile The profile.
|
||||
* @return The scores.
|
||||
*/
|
||||
public List<ScoreSaberScoresPageToken> getScores(UserScoreSaberProfile profile) {
|
||||
public List<ScoreSaberScoresPageToken> getScores(ScoreSaberProfile profile) {
|
||||
List<ScoreSaberScoresPageToken> scores = new ArrayList<>(List.of(getPageScores(profile, 1)));
|
||||
ScoreSaberPageMetadataToken metadata = scores.get(0).getMetadata();
|
||||
int totalPages = (int) Math.ceil((double) metadata.getTotal() / metadata.getItemsPerPage());
|
||||
log.info("Fetching {} pages of scores for account '{}'.", totalPages, profile.getSteamId());
|
||||
log.info("Fetching {} pages of scores for account '{}'.", totalPages, profile.getAccountId());
|
||||
for (int i = 2; i <= totalPages; i++) {
|
||||
scores.add(getPageScores(profile, i));
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ sentry:
|
||||
|
||||
# MongoDB Migration Configuration
|
||||
mongock:
|
||||
change-logs-scan-package: "cc.fascinated.bat.changelog"
|
||||
runner-type: InitializingBean
|
||||
migration-scan-package:
|
||||
- "cc.fascinated.bat.changelog"
|
||||
|
||||
# Spotify Configuration
|
||||
spotify:
|
||||
|
Loading…
x
Reference in New Issue
Block a user