Search in sources :

Example 1 with PlayHistory

use of se.michaelthelin.spotify.model_objects.specification.PlayHistory in project spotifybot by NotEchoDE.

the class LastSongCommand method exec.

@Override
@SneakyThrows
public void exec(String userName, String id, UserLevel userLevel, String[] args) {
    PagingCursorbased<PlayHistory> historyPagingCursorbased = getRoot().getSpotifyApi().getCurrentUsersRecentlyPlayedTracks().limit(1).build().execute();
    String trackId = historyPagingCursorbased.getItems()[0].getTrack().getId();
    Track track = getRoot().getSpotifyApi().getTrack(trackId).build().execute();
    sendMessage(getModule().getEntry("lastSong"), "$USER", userName, "$LASTSONG", track.getName(), "$ARTISTS", SpotifyUtils.getArtists(track));
}
Also used : PlayHistory(se.michaelthelin.spotify.model_objects.specification.PlayHistory) Track(se.michaelthelin.spotify.model_objects.specification.Track) SneakyThrows(lombok.SneakyThrows)

Aggregations

SneakyThrows (lombok.SneakyThrows)1 PlayHistory (se.michaelthelin.spotify.model_objects.specification.PlayHistory)1 Track (se.michaelthelin.spotify.model_objects.specification.Track)1