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) {
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();
}
}

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

@ -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),
@ -57,11 +53,15 @@ public class ScoreSaberCommand extends BatCommand {
if (!isSelf) {
interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention()))
.build()).queue();
.build())
.setEphemeral(true)
.queue();
}
interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You do not have a linked ScoreSaber account")
.build()).queue();
.build())
.setEphemeral(true)
.queue();
return;
}
@ -73,11 +73,15 @@ public class ScoreSaberCommand extends BatCommand {
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();
.build())
.setEphemeral(true)
.queue();
}
interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You have an invalid ScoreSaber account linked, please re-link your account")
.build()).queue();
.build())
.setEphemeral(true)
.queue();
return;
}
@ -98,12 +102,9 @@ public class ScoreSaberCommand extends BatCommand {
} catch (RateLimitException ex) {
interaction.replyEmbeds(EmbedUtils.errorEmbed()
.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) {
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();
.build())
.setEphemeral(true)
.queue();
return;
}
@ -54,7 +53,9 @@ public class UserSubCommand extends BatCommand {
if (target == null) {
event.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Unknown user")
.build()).queue();
.build())
.setEphemeral(true)
.queue();
return;
}
ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, event);