update scoresaber command messages
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m0s

This commit is contained in:
Lee 2024-07-04 15:42:16 +01:00
parent 7abdcd4d95
commit 9a5609f40e
4 changed files with 47 additions and 35 deletions

@ -37,7 +37,9 @@ public class LinkSubCommand extends BatCommand {
if (option == null) { if (option == null) {
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a ScoreSaber profile link") .setDescription("Please provide a ScoreSaber profile link")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
@ -45,7 +47,9 @@ public class LinkSubCommand extends BatCommand {
if (!link.contains("scoresaber.com/u/")) { if (!link.contains("scoresaber.com/u/")) {
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid ScoreSaber profile link") .setDescription("Invalid ScoreSaber profile link")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
@ -58,13 +62,17 @@ public class LinkSubCommand extends BatCommand {
if (account == null) { if (account == null) {
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid ScoreSaber profile link") .setDescription("Invalid ScoreSaber profile link")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
user.getScoreSaberProfile().setAccountId(id); user.getScoreSaberProfile().setAccountId(id);
event.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully linked your [ScoreSaber](%s) profile".formatted("https://scoresaber.com/u/%s".formatted(id))) .setDescription("Successfully linked your [ScoreSaber](%s) profile".formatted("https://scoresaber.com/u/%s".formatted(id)))
.build()).queue(); .build())
.setEphemeral(true)
.queue();
} }
} }

@ -25,6 +25,8 @@ public class ResetSubCommand extends BatCommand {
event.replyEmbeds(EmbedUtils.successEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully reset your settings.") .setDescription("Successfully reset your settings.")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
} }
} }

@ -28,14 +28,10 @@ import java.time.LocalDateTime;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @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 { public class ScoreSaberCommand extends BatCommand {
private final ScoreSaberService scoreSaberService;
@Autowired @Autowired
public ScoreSaberCommand(@NonNull ScoreSaberService scoreSaberService, @NonNull ApplicationContext context) { public ScoreSaberCommand(@NonNull ApplicationContext context) {
this.scoreSaberService = scoreSaberService;
super.addSubCommands( super.addSubCommands(
context.getBean(LinkSubCommand.class), context.getBean(LinkSubCommand.class),
context.getBean(UserSubCommand.class), context.getBean(UserSubCommand.class),
@ -57,11 +53,15 @@ public class ScoreSaberCommand extends BatCommand {
if (!isSelf) { if (!isSelf) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention())) .setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention()))
.build()).queue(); .build())
.setEphemeral(true)
.queue();
} }
interaction.replyEmbeds(EmbedUtils.errorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You do not have a linked ScoreSaber account") .setDescription("You do not have a linked ScoreSaber account")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
@ -73,11 +73,15 @@ public class ScoreSaberCommand extends BatCommand {
interaction.replyEmbeds(EmbedUtils.errorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("%s has an invalid ScoreSaber account linked, please ask them to re-link their account" .setDescription("%s has an invalid ScoreSaber account linked, please ask them to re-link their account"
.formatted(user.getDiscordUser().getAsMention())) .formatted(user.getDiscordUser().getAsMention()))
.build()).queue(); .build())
.setEphemeral(true)
.queue();
} }
interaction.replyEmbeds(EmbedUtils.errorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You have an invalid ScoreSaber account linked, please re-link your account") .setDescription("You have an invalid ScoreSaber account linked, please re-link your account")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
@ -98,12 +102,9 @@ public class ScoreSaberCommand extends BatCommand {
} catch (RateLimitException ex) { } catch (RateLimitException ex) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The ScoreSaber API is currently rate our limiting requests, please try again later") .setDescription("The ScoreSaber API is currently rate our limiting requests, please try again later")
.build()).queue(); .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);
}
} }

@ -37,16 +37,15 @@ public class UserSubCommand extends BatCommand {
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
OptionMapping option = event.getOption("user"); OptionMapping option = event.getOption("user");
if (option == null) { if (option == null) {
event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a user to view the ScoreSaber profile of")
.build()).queue();
return; return;
} }
if (option.getAsUser().isBot()) { if (option.getAsUser().isBot()) {
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You cannot view the ScoreSaber profile for a Bot") .setDescription("You cannot view the ScoreSaber profile for a Bot")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
@ -54,7 +53,9 @@ public class UserSubCommand extends BatCommand {
if (target == null) { if (target == null) {
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Unknown user") .setDescription("Unknown user")
.build()).queue(); .build())
.setEphemeral(true)
.queue();
return; return;
} }
ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, event); ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, event);