From 9a5609f40ecd0bc5ff36f90efa63e798818c0b6f Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 4 Jul 2024 15:42:16 +0100 Subject: [PATCH] update scoresaber command messages --- .../command/scoresaber/LinkSubCommand.java | 16 +++++-- .../command/scoresaber/ResetSubCommand.java | 6 ++- .../command/scoresaber/ScoreSaberCommand.java | 45 ++++++++++--------- .../command/scoresaber/UserSubCommand.java | 15 ++++--- 4 files changed, 47 insertions(+), 35 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/LinkSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/LinkSubCommand.java index 5ef9f8c..0088231 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/LinkSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/LinkSubCommand.java @@ -37,7 +37,9 @@ public class LinkSubCommand extends BatCommand { if (option == null) { event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a ScoreSaber profile link") - .build()).queue(); + .build()) + .setEphemeral(true) + .queue(); return; } @@ -45,7 +47,9 @@ public class LinkSubCommand extends BatCommand { if (!link.contains("scoresaber.com/u/")) { event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid ScoreSaber profile link") - .build()).queue(); + .build()) + .setEphemeral(true) + .queue(); return; } @@ -58,13 +62,17 @@ public class LinkSubCommand extends BatCommand { if (account == null) { event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid ScoreSaber profile link") - .build()).queue(); + .build()) + .setEphemeral(true) + .queue(); return; } user.getScoreSaberProfile().setAccountId(id); event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully linked your [ScoreSaber](%s) profile".formatted("https://scoresaber.com/u/%s".formatted(id))) - .build()).queue(); + .build()) + .setEphemeral(true) + .queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ResetSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ResetSubCommand.java index ada29b7..8d337e4 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ResetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ResetSubCommand.java @@ -24,7 +24,9 @@ public class ResetSubCommand extends BatCommand { profile.reset(); event.replyEmbeds(EmbedUtils.successEmbed() - .setDescription("Successfully reset your settings.") - .build()).queue(); + .setDescription("Successfully reset your settings.") + .build()) + .setEphemeral(true) + .queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java index 1a314b0..97fcfb2 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoreSaberCommand.java @@ -28,14 +28,10 @@ import java.time.LocalDateTime; * @author Fascinated (fascinated7) */ @Component -@CommandInfo(name = "scoresaber", description = "General ScoreSaber commands", guildOnly = false, userInstall = true, category = Category.BEAT_SABER) +@CommandInfo(name = "scoresaber", description = "General ScoreSaber commands", userInstall = true, category = Category.BEAT_SABER) public class ScoreSaberCommand extends BatCommand { - private final ScoreSaberService scoreSaberService; - @Autowired - public ScoreSaberCommand(@NonNull ScoreSaberService scoreSaberService, @NonNull ApplicationContext context) { - this.scoreSaberService = scoreSaberService; - + public ScoreSaberCommand(@NonNull ApplicationContext context) { super.addSubCommands( context.getBean(LinkSubCommand.class), context.getBean(UserSubCommand.class), @@ -56,12 +52,16 @@ public class ScoreSaberCommand extends BatCommand { if (profile.getAccountId() == null) { if (!isSelf) { interaction.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention())) - .build()).queue(); + .setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention())) + .build()) + .setEphemeral(true) + .queue(); } interaction.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("You do not have a linked ScoreSaber account") - .build()).queue(); + .setDescription("You do not have a linked ScoreSaber account") + .build()) + .setEphemeral(true) + .queue(); return; } @@ -71,13 +71,17 @@ public class ScoreSaberCommand extends BatCommand { if (account == null) { if (!isSelf) { interaction.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("%s has an invalid ScoreSaber account linked, please ask them to re-link their account" - .formatted(user.getDiscordUser().getAsMention())) - .build()).queue(); + .setDescription("%s has an invalid ScoreSaber account linked, please ask them to re-link their account" + .formatted(user.getDiscordUser().getAsMention())) + .build()) + .setEphemeral(true) + .queue(); } interaction.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("You have an invalid ScoreSaber account linked, please re-link your account") - .build()).queue(); + .setDescription("You have an invalid ScoreSaber account linked, please re-link your account") + .build()) + .setEphemeral(true) + .queue(); return; } @@ -97,13 +101,10 @@ public class ScoreSaberCommand extends BatCommand { .build()).queue(); } catch (RateLimitException ex) { interaction.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("The ScoreSaber API is currently rate our limiting requests, please try again later") - .build()).queue(); + .setDescription("The ScoreSaber API is currently rate our limiting requests, please try again later") + .build()) + .setEphemeral(true) + .queue(); } } - - @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { - sendProfileEmbed(true, user, scoreSaberService, event); - } } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/UserSubCommand.java index 87fb5df..5d59a44 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/UserSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/UserSubCommand.java @@ -37,24 +37,25 @@ public class UserSubCommand extends BatCommand { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { OptionMapping option = event.getOption("user"); if (option == null) { - event.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("Please provide a user to view the ScoreSaber profile of") - .build()).queue(); return; } if (option.getAsUser().isBot()) { event.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("You cannot view the ScoreSaber profile for a Bot") - .build()).queue(); + .setDescription("You cannot view the ScoreSaber profile for a Bot") + .build()) + .setEphemeral(true) + .queue(); return; } BatUser target = userService.getUser(option.getAsUser().getId()); if (target == null) { event.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("Unknown user") - .build()).queue(); + .setDescription("Unknown user") + .build()) + .setEphemeral(true) + .queue(); return; } ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, event);