big ass refactor to handle loading guilds and users without spring to make it more futureproof

This commit is contained in:
Lee
2024-07-01 01:12:32 +01:00
parent f566c3bcb5
commit d372c41c98
58 changed files with 755 additions and 638 deletions

View File

@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
*/
@Service
@Getter
@Log4j2
@Log4j2(topic = "Spotify Service")
public class SpotifyService {
/**
* The access token map.
@ -189,7 +189,6 @@ public class SpotifyService {
AuthorizationCodeCredentials credentials = api.authorizationCodeRefresh().build().execute();
profile.setAccessToken(credentials.getAccessToken());
profile.setExpiresAt(System.currentTimeMillis() + (credentials.getExpiresIn() * 1000));
userService.saveUser(user);
log.info("Refreshed Spotify token for user {}", user.getName());
} catch (SpotifyWebApiException ex) {
log.error("Failed to refresh Spotify token", ex);
@ -213,7 +212,6 @@ public class SpotifyService {
profile.setAccessToken(credentials.getAccessToken());
profile.setRefreshToken(credentials.getRefreshToken());
profile.setExpiresAt(System.currentTimeMillis() + (credentials.getExpiresIn() * 1000));
userService.saveUser(user);
log.info("Linked Spotify account for user {}", user.getName());
}