remove some debug and fix depends on for scoresaber service

This commit is contained in:
Lee 2024-07-05 19:49:16 +01:00
parent d575e0ec9e
commit bef2b695f5
3 changed files with 4 additions and 3 deletions

@ -14,6 +14,7 @@ import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import net.jodah.expiringmap.ExpiringMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
@ -29,6 +30,7 @@ import java.util.concurrent.TimeUnit;
@Service
@Log4j2(topic = "ScoreSaber Service")
@DependsOn("discordService")
public class ScoreSaberService extends TextWebSocketHandler {
private static final String SCORESABER_API = "https://scoresaber.com/api/";
private static final String GET_PLAYER_ENDPOINT = SCORESABER_API + "player/%s/full";

@ -10,6 +10,7 @@ import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import net.jodah.expiringmap.ExpiringMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
import se.michaelthelin.spotify.SpotifyApi;
import se.michaelthelin.spotify.enums.AuthorizationScope;
@ -27,6 +28,7 @@ import java.util.concurrent.TimeUnit;
@Service
@Getter
@Log4j2(topic = "Spotify Service")
@DependsOn("discordService")
public class SpotifyService {
/**
* The access token map.

@ -63,7 +63,6 @@ public class UserService implements EventListener {
if (document != null) {
BatUser batUser = new BatUser(id, user, document);
users.put(id, batUser);
// log.info("Loaded user \"{}\" in {}ms", batUser.getName(),System.currentTimeMillis() - before);
return batUser;
}
// New user
@ -82,11 +81,9 @@ public class UserService implements EventListener {
public BatUser getUser(@NonNull String id) {
User user = DiscordService.JDA.getUserById(id);
if (user == null) {
log.warn("Attempted to get user with ID \"{}\" but they do not exist", id);
return null;
}
if (user.isBot()) {
log.warn("Attempted to get user with ID \"{}\" but they are a bot", id);
return null;
}
return getUser(id, null);