diff --git a/pom.xml b/pom.xml index 93d845e..ef6b956 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,24 @@ sentry-spring-boot-starter-jakarta 7.10.0 + + io.mongock + mongock-bom + 5.2.4 + pom + import + + + io.mongock + mongock-springboot-v3 + 5.2.4 + + + io.mongock + mongodb-springdata-v4-driver + 5.2.4 + + diff --git a/src/main/java/cc/fascinated/bat/BatApplication.java b/src/main/java/cc/fascinated/bat/BatApplication.java index 330697e..a5e1e32 100644 --- a/src/main/java/cc/fascinated/bat/BatApplication.java +++ b/src/main/java/cc/fascinated/bat/BatApplication.java @@ -2,6 +2,7 @@ package cc.fascinated.bat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import io.mongock.runner.springboot.EnableMongock; import lombok.NonNull; import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; @@ -16,6 +17,7 @@ import java.util.Objects; @EnableScheduling @SpringBootApplication +@EnableMongock @Log4j2(topic = "Bat") public class BatApplication { public static Gson GSON = new GsonBuilder().create(); diff --git a/src/main/java/cc/fascinated/bat/changelog/BirthdayProfileChangelog.java b/src/main/java/cc/fascinated/bat/changelog/BirthdayProfileChangelog.java new file mode 100644 index 0000000..0882fa2 --- /dev/null +++ b/src/main/java/cc/fascinated/bat/changelog/BirthdayProfileChangelog.java @@ -0,0 +1,43 @@ +package cc.fascinated.bat.changelog; + +import com.mongodb.client.FindIterable; +import io.mongock.api.annotations.ChangeUnit; +import io.mongock.api.annotations.Execution; +import io.mongock.api.annotations.RollbackExecution; +import org.bson.Document; +import org.springframework.data.mongodb.core.MongoTemplate; + +import javax.print.Doc; + +/** + * @author Fascinated (fascinated7) + */ +@ChangeUnit(id="birthday-changelog", order = "001", author = "fascinated7") +public class BirthdayProfileChangelog { + private final MongoTemplate mongoTemplate; + + public BirthdayProfileChangelog(MongoTemplate mongoTemplate) { + this.mongoTemplate = mongoTemplate; + } + + @Execution + public void changeSet() { + FindIterable guilds = mongoTemplate.getCollection("guilds").find(); + guilds.forEach(guild -> { + Document profiles = guild.get("profiles", Document.class); + if (profiles == null) { + return; + } + Document birthdayProfile = profiles.get("birthday", Document.class); + birthdayProfile.remove("birthdays"); + profiles.put("birthday", birthdayProfile); + guild.put("profiles", profiles); + mongoTemplate.getCollection("guilds").replaceOne(new Document("_id", guild.get("_id")), guild); + }); + } + + @RollbackExecution + public void rollback() { + // DO NOTHING + } +} \ No newline at end of file diff --git a/src/main/java/cc/fascinated/bat/changelog/MongockSuccessEventListener.java b/src/main/java/cc/fascinated/bat/changelog/MongockSuccessEventListener.java new file mode 100644 index 0000000..3270352 --- /dev/null +++ b/src/main/java/cc/fascinated/bat/changelog/MongockSuccessEventListener.java @@ -0,0 +1,15 @@ +package cc.fascinated.bat.changelog; + +import io.mongock.runner.spring.base.events.SpringMigrationSuccessEvent; +import lombok.extern.log4j.Log4j2; +import org.jetbrains.annotations.NotNull; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +@Component @Log4j2 +public class MongockSuccessEventListener implements ApplicationListener { + @Override + public void onApplicationEvent(@NotNull SpringMigrationSuccessEvent event) { + log.info("Successfully ran Mongock migrations"); + } +} \ No newline at end of file diff --git a/src/main/java/cc/fascinated/bat/common/SpotifyUtils.java b/src/main/java/cc/fascinated/bat/common/SpotifyUtils.java index 28e90a4..bb34694 100644 --- a/src/main/java/cc/fascinated/bat/common/SpotifyUtils.java +++ b/src/main/java/cc/fascinated/bat/common/SpotifyUtils.java @@ -57,7 +57,7 @@ public class SpotifyUtils { Thread.sleep(250); checks++; } else { - log.info("Found new track {} in {} checks", track.getName(), checks); + log.info("Found new track \"{}\" in {} check{}", track.getName(), checks, checks == 1 ? "" : "s"); return currentlyPlaying; } } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/BirthdayFeature.java b/src/main/java/cc/fascinated/bat/features/birthday/BirthdayFeature.java index 2210fe9..3146132 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/BirthdayFeature.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/BirthdayFeature.java @@ -29,7 +29,7 @@ public class BirthdayFeature extends Feature { /** * Check birthdays every day at midnight */ - @Scheduled(cron = "0 0 0 * * *") + @Scheduled(cron = "0 1 0 * * *") private void checkBirthdays() { for (BatGuild guild : guildService.getAllGuilds()) { BirthdayProfile profile = guild.getProfile(BirthdayProfile.class); diff --git a/src/main/java/cc/fascinated/bat/features/birthday/UserBirthday.java b/src/main/java/cc/fascinated/bat/features/birthday/UserBirthday.java new file mode 100644 index 0000000..70471e7 --- /dev/null +++ b/src/main/java/cc/fascinated/bat/features/birthday/UserBirthday.java @@ -0,0 +1,27 @@ +package cc.fascinated.bat.features.birthday; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.Date; + +/** + * @author Fascinated (fascinated7) + */ +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class UserBirthday { + /** + * The user's birthday + */ + private Date birthday; + + /** + * If the birthday should be hidden + */ + private boolean hidden; +} diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/BirthdayCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/BirthdayCommand.java index 148a2ec..8518fa6 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/BirthdayCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/BirthdayCommand.java @@ -19,5 +19,7 @@ public class BirthdayCommand extends BatCommand { super.addSubCommand(context.getBean(RemoveSubCommand.class)); super.addSubCommand(context.getBean(ChannelSubCommand.class)); super.addSubCommand(context.getBean(MessageSubCommand.class)); + super.addSubCommand(context.getBean(ViewSubCommand.class)); + super.addSubCommand(context.getBean(PrivateSubCommand.class)); } } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java new file mode 100644 index 0000000..58909a5 --- /dev/null +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java @@ -0,0 +1,62 @@ +package cc.fascinated.bat.features.birthday.command; + +import cc.fascinated.bat.command.BatSubCommand; +import cc.fascinated.bat.command.CommandInfo; +import cc.fascinated.bat.common.EmbedUtils; +import cc.fascinated.bat.features.birthday.UserBirthday; +import cc.fascinated.bat.features.birthday.profile.BirthdayProfile; +import cc.fascinated.bat.model.BatGuild; +import cc.fascinated.bat.model.BatUser; +import cc.fascinated.bat.service.GuildService; +import lombok.NonNull; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; +import net.dv8tion.jda.api.interactions.commands.OptionMapping; +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + +/** + * @author Fascinated (fascinated7) + */ +@Component("birthday:private.sub") +@CommandInfo(name = "private", description = "Changes whether your birthday is private or not") +public class PrivateSubCommand extends BatSubCommand { + private final GuildService guildService; + + @Autowired + public PrivateSubCommand(@NonNull GuildService guildService) { + this.guildService = guildService; + super.addOption(OptionType.BOOLEAN, "enabled", "Whether your birthday is private or not", true); + } + + @Override + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + BirthdayProfile profile = guild.getProfile(BirthdayProfile.class); + OptionMapping enabledOption = interaction.getOption("enabled"); + if (enabledOption == null) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("You must provide whether your birthday is private or not") + .build()).queue(); + return; + } + + boolean enabled = enabledOption.getAsBoolean(); + UserBirthday birthday = profile.getBirthday(user.getId()); + if (birthday == null) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("You have not set your birthday yet") + .build()).queue(); + return; + } + + birthday.setHidden(enabled); + guildService.saveGuild(guild); + + interaction.replyEmbeds(EmbedUtils.successEmbed() + .setDescription("Your birthday privacy settings have been updated\n\n**Private:** " + (enabled ? "Yes" : "No")) + .build()).queue(); + } +} diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java index ecf6a46..245850f 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java @@ -3,6 +3,7 @@ package cc.fascinated.bat.features.birthday.command; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.common.EmbedUtils; +import cc.fascinated.bat.features.birthday.UserBirthday; import cc.fascinated.bat.features.birthday.profile.BirthdayProfile; import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; @@ -63,7 +64,7 @@ public class SetSubCommand extends BatSubCommand { return; } - profile.addBirthday(member.getId(), birthday); + profile.addBirthday(member.getId(), new UserBirthday(birthday, false)); guildService.saveGuild(guild); interaction.replyEmbeds(EmbedUtils.successEmbed() diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java new file mode 100644 index 0000000..56cf3af --- /dev/null +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java @@ -0,0 +1,76 @@ +package cc.fascinated.bat.features.birthday.command; + +import cc.fascinated.bat.command.BatSubCommand; +import cc.fascinated.bat.command.CommandInfo; +import cc.fascinated.bat.common.EmbedUtils; +import cc.fascinated.bat.features.birthday.UserBirthday; +import cc.fascinated.bat.features.birthday.profile.BirthdayProfile; +import cc.fascinated.bat.model.BatGuild; +import cc.fascinated.bat.model.BatUser; +import cc.fascinated.bat.service.GuildService; +import lombok.NonNull; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; +import net.dv8tion.jda.api.interactions.commands.OptionMapping; +import net.dv8tion.jda.api.interactions.commands.OptionType; +import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + +/** + * @author Fascinated (fascinated7) + */ +@Component("birthday:view.sub") +@CommandInfo(name = "view", description = "Add your birthday to this guild") +public class ViewSubCommand extends BatSubCommand { + @Autowired + public ViewSubCommand(GuildService guildService) { + super.addOption(OptionType.USER, "user", "The user to view the birthday of", false); + } + + @Override + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + BirthdayProfile profile = guild.getProfile(BirthdayProfile.class); + + if (!profile.hasChannelSetup()) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.") + .build()).queue(); + return; + } + + OptionMapping birthdayOption = interaction.getOption("user"); + if (birthdayOption == null) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("You must provide a birthday") + .build()).queue(); + return; + } + + Member targetMember = birthdayOption.getAsMember(); + if (targetMember == null) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("You must provide a valid user") + .build()).queue(); + return; + } + UserBirthday birthday = profile.getBirthday(targetMember.getId()); + if (birthday == null) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("This user does not have a birthday set") + .build()).queue(); + return; + } + if (birthday.isHidden() && !user.getId().equals(targetMember.getId())) { + interaction.replyEmbeds(EmbedUtils.errorEmbed() + .setDescription("%s has their birthday set to private".formatted(targetMember.getAsMention())) + .build()).queue(); + return; + } + + interaction.replyEmbeds(EmbedUtils.successEmbed() + .setDescription("%s's birthday is ".formatted(member.getAsMention(), birthday.getBirthday().toInstant().toEpochMilli()/1000)) + .build()).queue(); + } +} diff --git a/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java b/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java index 3e64aa6..e264396 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/profile/BirthdayProfile.java @@ -1,6 +1,7 @@ package cc.fascinated.bat.features.birthday.profile; import cc.fascinated.bat.common.Profile; +import cc.fascinated.bat.features.birthday.UserBirthday; import cc.fascinated.bat.model.BatGuild; import lombok.Getter; import lombok.Setter; @@ -22,7 +23,7 @@ public class BirthdayProfile extends Profile { /** * The list of birthdays that are being tracked */ - private Map birthdays; + private Map birthdays; /** * The channel ID of the birthday feed @@ -44,7 +45,7 @@ public class BirthdayProfile extends Profile { * @param userId the id of the user to track * @param birthday the birthday of the user */ - public void addBirthday(String userId, Date birthday) { + public void addBirthday(String userId, UserBirthday birthday) { if (birthdays == null) { birthdays = new HashMap<>(); } @@ -69,7 +70,7 @@ public class BirthdayProfile extends Profile { * @param userId the id of the user * @return the birthday of the user */ - public Date getBirthday(String userId) { + public UserBirthday getBirthday(String userId) { if (birthdays == null) { birthdays = new HashMap<>(); } @@ -92,13 +93,13 @@ public class BirthdayProfile extends Profile { * @return the age of the user */ public int calculateAge(String userId) { - Date birthday = getBirthday(userId); + UserBirthday birthday = getBirthday(userId); if (birthday == null) { return 0; // or throw an exception } Calendar birthdayCalendar = Calendar.getInstance(); - birthdayCalendar.setTime(birthday); + birthdayCalendar.setTime(birthday.getBirthday()); Calendar today = Calendar.getInstance(); @@ -125,9 +126,9 @@ public class BirthdayProfile extends Profile { List toRemove = new ArrayList<>(); Guild discordGuild = guild.getDiscordGuild(); - for (Map.Entry entry : birthdays.entrySet()) { + for (Map.Entry entry : birthdays.entrySet()) { String userId = entry.getKey(); - Date birthday = entry.getValue(); + Date birthday = entry.getValue().getBirthday(); if (userId == null || birthday == null) { // this should never happen continue; @@ -170,13 +171,10 @@ public class BirthdayProfile extends Profile { int todayDay = today.get(Calendar.DAY_OF_MONTH); int todayMonth = today.get(Calendar.MONTH); // Note: January is 0 - Iterator> iterator = birthdays.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - Date birthday = entry.getValue(); + for (Map.Entry entry : birthdays.entrySet()) { + Date birthday = entry.getValue().getBirthday(); if (birthday == null) { - iterator.remove(); continue; } diff --git a/src/main/java/cc/fascinated/bat/features/spotify/SpotifyFeature.java b/src/main/java/cc/fascinated/bat/features/spotify/SpotifyFeature.java index eb8cafe..e3af5af 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/SpotifyFeature.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/SpotifyFeature.java @@ -9,13 +9,9 @@ import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.spotify.profile.SpotifyProfile; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.SpotifyService; -import com.fasterxml.jackson.datatype.jsr310.deser.JSR310DateTimeDeserializerBase; import lombok.NonNull; import lombok.SneakyThrows; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.MessageEmbed; -import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; -import net.dv8tion.jda.api.interactions.components.ComponentInteraction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying; diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java index 7bab2b5..d258f20 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java @@ -3,11 +3,9 @@ package cc.fascinated.bat.features.spotify.command; import cc.fascinated.bat.Emojis; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; -import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.event.EventListener; import cc.fascinated.bat.exception.BatException; import cc.fascinated.bat.features.spotify.SpotifyFeature; -import cc.fascinated.bat.features.spotify.profile.SpotifyProfile; import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.SpotifyService; diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java index 53f1837..f0b601c 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java @@ -1,12 +1,8 @@ package cc.fascinated.bat.features.spotify.command; -import cc.fascinated.bat.Emojis; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; -import cc.fascinated.bat.common.EmbedUtils; -import cc.fascinated.bat.common.SpotifyUtils; import cc.fascinated.bat.features.spotify.SpotifyFeature; -import cc.fascinated.bat.features.spotify.profile.SpotifyProfile; import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.SpotifyService; @@ -16,8 +12,6 @@ import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying; -import se.michaelthelin.spotify.model_objects.specification.Track; /** * @author Fascinated (fascinated7) diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java index 7eb8926..bacece1 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java @@ -1,12 +1,8 @@ package cc.fascinated.bat.features.spotify.command; -import cc.fascinated.bat.Emojis; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; -import cc.fascinated.bat.common.EmbedUtils; -import cc.fascinated.bat.common.SpotifyUtils; import cc.fascinated.bat.features.spotify.SpotifyFeature; -import cc.fascinated.bat.features.spotify.profile.SpotifyProfile; import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.SpotifyService; @@ -16,8 +12,6 @@ import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying; -import se.michaelthelin.spotify.model_objects.specification.Track; /** * @author Fascinated (fascinated7) diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java index 4b7bd52..9443caa 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java @@ -1,12 +1,8 @@ package cc.fascinated.bat.features.spotify.command; -import cc.fascinated.bat.Emojis; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; -import cc.fascinated.bat.common.EmbedUtils; -import cc.fascinated.bat.common.SpotifyUtils; import cc.fascinated.bat.features.spotify.SpotifyFeature; -import cc.fascinated.bat.features.spotify.profile.SpotifyProfile; import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.SpotifyService; @@ -18,9 +14,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import se.michaelthelin.spotify.model_objects.IPlaylistItem; -import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying; -import se.michaelthelin.spotify.model_objects.specification.Track; /** * @author Fascinated (fascinated7) diff --git a/src/main/java/cc/fascinated/bat/service/SpotifyService.java b/src/main/java/cc/fascinated/bat/service/SpotifyService.java index a17318a..991dde1 100644 --- a/src/main/java/cc/fascinated/bat/service/SpotifyService.java +++ b/src/main/java/cc/fascinated/bat/service/SpotifyService.java @@ -9,7 +9,6 @@ import lombok.NonNull; import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; import net.jodah.expiringmap.ExpiringMap; -import org.apache.hc.core5.http.ParseException; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import se.michaelthelin.spotify.SpotifyApi; @@ -18,7 +17,6 @@ import se.michaelthelin.spotify.exceptions.SpotifyWebApiException; import se.michaelthelin.spotify.model_objects.credentials.AuthorizationCodeCredentials; import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying; -import java.io.IOException; import java.net.URI; import java.util.Map; import java.util.concurrent.TimeUnit;