forked from Fascinated/Bat
remove some debug and fix depends on for scoresaber service
This commit is contained in:
parent
d575e0ec9e
commit
bef2b695f5
@ -14,6 +14,7 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import net.jodah.expiringmap.ExpiringMap;
|
import net.jodah.expiringmap.ExpiringMap;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.DependsOn;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.socket.CloseStatus;
|
import org.springframework.web.socket.CloseStatus;
|
||||||
import org.springframework.web.socket.TextMessage;
|
import org.springframework.web.socket.TextMessage;
|
||||||
@ -29,6 +30,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Log4j2(topic = "ScoreSaber Service")
|
@Log4j2(topic = "ScoreSaber Service")
|
||||||
|
@DependsOn("discordService")
|
||||||
public class ScoreSaberService extends TextWebSocketHandler {
|
public class ScoreSaberService extends TextWebSocketHandler {
|
||||||
private static final String SCORESABER_API = "https://scoresaber.com/api/";
|
private static final String SCORESABER_API = "https://scoresaber.com/api/";
|
||||||
private static final String GET_PLAYER_ENDPOINT = SCORESABER_API + "player/%s/full";
|
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 lombok.extern.log4j.Log4j2;
|
||||||
import net.jodah.expiringmap.ExpiringMap;
|
import net.jodah.expiringmap.ExpiringMap;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.DependsOn;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import se.michaelthelin.spotify.SpotifyApi;
|
import se.michaelthelin.spotify.SpotifyApi;
|
||||||
import se.michaelthelin.spotify.enums.AuthorizationScope;
|
import se.michaelthelin.spotify.enums.AuthorizationScope;
|
||||||
@ -27,6 +28,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Service
|
@Service
|
||||||
@Getter
|
@Getter
|
||||||
@Log4j2(topic = "Spotify Service")
|
@Log4j2(topic = "Spotify Service")
|
||||||
|
@DependsOn("discordService")
|
||||||
public class SpotifyService {
|
public class SpotifyService {
|
||||||
/**
|
/**
|
||||||
* The access token map.
|
* The access token map.
|
||||||
|
@ -63,7 +63,6 @@ public class UserService implements EventListener {
|
|||||||
if (document != null) {
|
if (document != null) {
|
||||||
BatUser batUser = new BatUser(id, user, document);
|
BatUser batUser = new BatUser(id, user, document);
|
||||||
users.put(id, batUser);
|
users.put(id, batUser);
|
||||||
// log.info("Loaded user \"{}\" in {}ms", batUser.getName(),System.currentTimeMillis() - before);
|
|
||||||
return batUser;
|
return batUser;
|
||||||
}
|
}
|
||||||
// New user
|
// New user
|
||||||
@ -82,11 +81,9 @@ public class UserService implements EventListener {
|
|||||||
public BatUser getUser(@NonNull String id) {
|
public BatUser getUser(@NonNull String id) {
|
||||||
User user = DiscordService.JDA.getUserById(id);
|
User user = DiscordService.JDA.getUserById(id);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
log.warn("Attempted to get user with ID \"{}\" but they do not exist", id);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (user.isBot()) {
|
if (user.isBot()) {
|
||||||
log.warn("Attempted to get user with ID \"{}\" but they are a bot", id);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return getUser(id, null);
|
return getUser(id, null);
|
||||||
|
Loading…
Reference in New Issue
Block a user