package cc.fascinated.bat.reminder.command; import cc.fascinated.bat.common.oldcommand.BatCommand; import cc.fascinated.bat.common.oldcommand.CommandInfo; import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.reminder.ReminderProfile; import cc.fascinated.bat.common.model.BatGuild; import cc.fascinated.bat.common.model.BatUser; import lombok.NonNull; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import org.springframework.stereotype.Component; /** * @author Fascinated (fascinated7) */ @Component("reminder:clear.sub") @CommandInfo(name = "clear", description = "Clear all your active reminders.") public class ClearSubCommand extends BatCommand { @Override public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) { ReminderProfile profile = guild.getReminderProfile(); if (!profile.hasReminders(user.getDiscordUser())) { event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You do not have any active reminders.") .build()).queue(); return; } int reminderCount = profile.getReminderCount(user.getDiscordUser()); profile.removeReminders(user.getDiscordUser()); event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully cleared %s reminders.".formatted(reminderCount)) .build() ).queue(); } }