more embed cleanup

This commit is contained in:
Lee 2024-06-25 13:59:02 +01:00
parent 0d1eb3089a
commit 519cb72c14
17 changed files with 45 additions and 59 deletions

@ -16,7 +16,7 @@ public class EmbedUtils {
* *
* @return the embed builder * @return the embed builder
*/ */
public static EmbedBuilder buildGenericEmbed() { public static EmbedBuilder genericEmbed() {
return new EmbedBuilder() return new EmbedBuilder()
.setTimestamp(LocalDateTime.now()) .setTimestamp(LocalDateTime.now())
.setColor(Colors.DEFAULT); .setColor(Colors.DEFAULT);
@ -27,7 +27,7 @@ public class EmbedUtils {
* *
* @return the embed builder * @return the embed builder
*/ */
public static EmbedBuilder buildErrorEmbed() { public static EmbedBuilder errorEmbed() {
return new EmbedBuilder() return new EmbedBuilder()
.setTimestamp(LocalDateTime.now()) .setTimestamp(LocalDateTime.now())
.setColor(Colors.ERROR); .setColor(Colors.ERROR);
@ -38,7 +38,7 @@ public class EmbedUtils {
* *
* @return the embed builder * @return the embed builder
*/ */
public static EmbedBuilder buildSuccessEmbed() { public static EmbedBuilder successEmbed() {
return new EmbedBuilder() return new EmbedBuilder()
.setTimestamp(LocalDateTime.now()) .setTimestamp(LocalDateTime.now())
.setColor(Colors.SUCCESS); .setColor(Colors.SUCCESS);

@ -7,7 +7,6 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.GuildService; import cc.fascinated.bat.service.GuildService;
import lombok.NonNull; import lombok.NonNull;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
@ -32,7 +31,7 @@ public class AddSubCommand extends BatSubCommand {
public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) { public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
if (profile.getRoleSlotsInUse() >= profile.getMaxRoles()) { if (profile.getRoleSlotsInUse() >= profile.getMaxRoles()) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("You can only have a maximum of %d roles set for the auto role feature" .setDescription("You can only have a maximum of %d roles set for the auto role feature"
.formatted(profile.getMaxRoles())) .formatted(profile.getMaxRoles()))
.build()).queue(); .build()).queue();
@ -41,7 +40,7 @@ public class AddSubCommand extends BatSubCommand {
OptionMapping option = interaction.getOption("role"); OptionMapping option = interaction.getOption("role");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a role to add") .setDescription("Please provide a role to add")
.build()).queue(); .build()).queue();
return; return;
@ -49,7 +48,7 @@ public class AddSubCommand extends BatSubCommand {
Role role = option.getAsRole(); Role role = option.getAsRole();
if (profile.hasRole(role.getId())) { if (profile.hasRole(role.getId())) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The role %s is already in the auto roles list".formatted(role.getAsMention())) .setDescription("The role %s is already in the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
return; return;
@ -57,7 +56,7 @@ public class AddSubCommand extends BatSubCommand {
profile.addRole(role.getId()); profile.addRole(role.getId());
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully added the role %s to the auto roles list".formatted(role.getAsMention())) .setDescription("Successfully added the role %s to the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -8,9 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.GuildService; import cc.fascinated.bat.service.GuildService;
import lombok.NonNull; import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -33,7 +31,7 @@ public class ClearSubCommand extends BatSubCommand {
profile.clearRoles(); profile.clearRoles();
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully cleared all auto roles") .setDescription("Successfully cleared all auto roles")
.build()).queue(); .build()).queue();
} }

@ -3,7 +3,6 @@ package cc.fascinated.bat.features.autorole.command;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.features.autorole.profile.AutoRoleProfile; import cc.fascinated.bat.features.autorole.profile.AutoRoleProfile;
import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import lombok.NonNull; import lombok.NonNull;
@ -23,7 +22,7 @@ public class ListSubCommand extends BatSubCommand {
public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) { public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
if (profile.getRoles().isEmpty()) { if (profile.getRoles().isEmpty()) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There are no auto roles set") .setDescription("There are no auto roles set")
.build()).queue(); .build()).queue();
return; return;
@ -38,7 +37,7 @@ public class ListSubCommand extends BatSubCommand {
roles.append("%d. %s\n".formatted(i + 1, profile.getRoles().get(i).getAsMention())); roles.append("%d. %s\n".formatted(i + 1, profile.getRoles().get(i).getAsMention()));
} }
EmbedBuilder embed = EmbedUtils.buildGenericEmbed(); EmbedBuilder embed = EmbedUtils.genericEmbed();
embed.setTitle("Auto Role List"); embed.setTitle("Auto Role List");
embed.setDescription(roles.toString()); embed.setDescription(roles.toString());
interaction.replyEmbeds(embed.build()).queue(); interaction.replyEmbeds(embed.build()).queue();

@ -32,7 +32,7 @@ public class RemoveSubCommand extends BatSubCommand {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
OptionMapping option = interaction.getOption("role"); OptionMapping option = interaction.getOption("role");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a role to remove") .setDescription("Please provide a role to remove")
.build()).queue(); .build()).queue();
return; return;
@ -40,7 +40,7 @@ public class RemoveSubCommand extends BatSubCommand {
Role role = option.getAsRole(); Role role = option.getAsRole();
if (!profile.hasRole(role.getId())) { if (!profile.hasRole(role.getId())) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The role %s is not in the auto roles list".formatted(role.getAsMention())) .setDescription("The role %s is not in the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
return; return;
@ -48,7 +48,7 @@ public class RemoveSubCommand extends BatSubCommand {
profile.removeRole(role.getId()); profile.removeRole(role.getId());
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Successfully removed the role %s from the auto roles list".formatted(role.getAsMention())) .setDescription("Successfully removed the role %s from the auto roles list".formatted(role.getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -1,9 +1,6 @@
package cc.fascinated.bat.features.scoresaber; package cc.fascinated.bat.features.scoresaber;
import cc.fascinated.bat.common.Colors; import cc.fascinated.bat.common.*;
import cc.fascinated.bat.common.DateUtils;
import cc.fascinated.bat.common.NumberUtils;
import cc.fascinated.bat.common.ScoreSaberUtils;
import cc.fascinated.bat.event.EventListener; import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.scoresaber.profile.GuildNumberOneScoreFeedProfile; import cc.fascinated.bat.features.scoresaber.profile.GuildNumberOneScoreFeedProfile;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
@ -13,7 +10,6 @@ import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberScoreToken;
import cc.fascinated.bat.service.DiscordService; import cc.fascinated.bat.service.DiscordService;
import cc.fascinated.bat.service.GuildService; import cc.fascinated.bat.service.GuildService;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
@ -74,7 +70,7 @@ public class NumberOneScoreFeedListener implements EventListener {
ScoreSaberScoreToken scoreToken = score.getScore(); ScoreSaberScoreToken scoreToken = score.getScore();
ScoreSaberLeaderboardToken leaderboardToken = score.getLeaderboard(); ScoreSaberLeaderboardToken leaderboardToken = score.getLeaderboard();
ScoreSaberScoreToken.LeaderboardPlayerInfo playerInfo = scoreToken.getLeaderboardPlayerInfo(); ScoreSaberScoreToken.LeaderboardPlayerInfo playerInfo = scoreToken.getLeaderboardPlayerInfo();
return new EmbedBuilder() return EmbedUtils.genericEmbed()
.setAuthor(playerInfo.getName() + " just set a new #1!", "https://scoresaber.com/u/%s".formatted(playerInfo.getId()), .setAuthor(playerInfo.getName() + " just set a new #1!", "https://scoresaber.com/u/%s".formatted(playerInfo.getId()),
"https://cdn.scoresaber.com/avatars/%s.jpg".formatted(playerInfo.getId())) "https://cdn.scoresaber.com/avatars/%s.jpg".formatted(playerInfo.getId()))
.setDescription("**%s** (%s%s)\n[[Map Link]](%s) [[SS Profile]](%s)".formatted( .setDescription("**%s** (%s%s)\n[[Map Link]](%s) [[SS Profile]](%s)".formatted(
@ -95,7 +91,6 @@ public class NumberOneScoreFeedListener implements EventListener {
scoreToken.getMaxCombo(), scoreToken.getMaxCombo(),
scoreToken.getMaxCombo() == leaderboardToken.getMaxScore() ? "(FC)" : "" scoreToken.getMaxCombo() == leaderboardToken.getMaxScore() ? "(FC)" : ""
), true) ), true)
.setColor(Colors.DEFAULT)
.setTimestamp(DateUtils.getDateFromString(scoreToken.getTimeSet()).toInstant()) .setTimestamp(DateUtils.getDateFromString(scoreToken.getTimeSet()).toInstant())
.build(); .build();
} }

@ -1,9 +1,6 @@
package cc.fascinated.bat.features.scoresaber; package cc.fascinated.bat.features.scoresaber;
import cc.fascinated.bat.common.Colors; import cc.fascinated.bat.common.*;
import cc.fascinated.bat.common.DateUtils;
import cc.fascinated.bat.common.NumberUtils;
import cc.fascinated.bat.common.ScoreSaberUtils;
import cc.fascinated.bat.event.EventListener; import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile; import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile;
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberLeaderboardToken; import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberLeaderboardToken;
@ -13,7 +10,6 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.service.DiscordService; import cc.fascinated.bat.service.DiscordService;
import cc.fascinated.bat.service.GuildService; import cc.fascinated.bat.service.GuildService;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
@ -67,7 +63,7 @@ public class UserScoreFeedListener implements EventListener {
ScoreSaberScoreToken scoreToken = score.getScore(); ScoreSaberScoreToken scoreToken = score.getScore();
ScoreSaberLeaderboardToken leaderboardToken = score.getLeaderboard(); ScoreSaberLeaderboardToken leaderboardToken = score.getLeaderboard();
ScoreSaberScoreToken.LeaderboardPlayerInfo playerInfo = scoreToken.getLeaderboardPlayerInfo(); ScoreSaberScoreToken.LeaderboardPlayerInfo playerInfo = scoreToken.getLeaderboardPlayerInfo();
return new EmbedBuilder() return EmbedUtils.genericEmbed()
.setAuthor(playerInfo.getName() + " just set a new score!", "https://scoresaber.com/u/%s".formatted(playerInfo.getId()), .setAuthor(playerInfo.getName() + " just set a new score!", "https://scoresaber.com/u/%s".formatted(playerInfo.getId()),
"https://cdn.scoresaber.com/avatars/%s.jpg".formatted(playerInfo.getId())) "https://cdn.scoresaber.com/avatars/%s.jpg".formatted(playerInfo.getId()))
.setDescription("**%s** (%s%s)\n[[Map Link]](%s) [[SS Profile]](%s)".formatted( .setDescription("**%s** (%s%s)\n[[Map Link]](%s) [[SS Profile]](%s)".formatted(
@ -88,7 +84,6 @@ public class UserScoreFeedListener implements EventListener {
scoreToken.getMaxCombo(), scoreToken.getMaxCombo(),
scoreToken.getMaxCombo() == leaderboardToken.getMaxScore() ? "(FC)" : "" scoreToken.getMaxCombo() == leaderboardToken.getMaxScore() ? "(FC)" : ""
), true) ), true)
.setColor(Colors.DEFAULT)
.setTimestamp(DateUtils.getDateFromString(scoreToken.getTimeSet()).toInstant()) .setTimestamp(DateUtils.getDateFromString(scoreToken.getTimeSet()).toInstant())
.build(); .build();
} }

@ -35,12 +35,12 @@ public class ChannelSubCommand extends BatSubCommand {
OptionMapping option = interaction.getOption("channel"); OptionMapping option = interaction.getOption("channel");
if (option == null) { if (option == null) {
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a channel to set the ScoreSaber #1 feed channel to") .setDescription("Please provide a channel to set the ScoreSaber #1 feed channel to")
.build()).queue(); .build()).queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The current ScoreSaber #1 feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .setDescription("The current ScoreSaber #1 feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId())))
.build()).queue(); .build()).queue();
return; return;
@ -48,7 +48,7 @@ public class ChannelSubCommand extends BatSubCommand {
GuildChannelUnion targetChannel = option.getAsChannel(); GuildChannelUnion targetChannel = option.getAsChannel();
if (targetChannel.getType() != ChannelType.TEXT) { if (targetChannel.getType() != ChannelType.TEXT) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid channel type, please provide a text channel") .setDescription("Invalid channel type, please provide a text channel")
.build()).queue(); .build()).queue();
return; return;
@ -57,7 +57,7 @@ public class ChannelSubCommand extends BatSubCommand {
profile.setChannelId(targetChannel.getId()); profile.setChannelId(targetChannel.getId());
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Successfully set the ScoreSaber #1 feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .setDescription("Successfully set the ScoreSaber #1 feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -31,7 +31,7 @@ public class ClearChannelSubCommand extends BatSubCommand {
profile.setChannelId(null); profile.setChannelId(null);
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Successfully cleared the ScoreSaber #1 feed channel") .setDescription("Successfully cleared the ScoreSaber #1 feed channel")
.build()).queue(); .build()).queue();
} }

@ -34,7 +34,7 @@ public class LinkSubCommand extends BatSubCommand {
public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) { public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) {
OptionMapping option = interaction.getOption("link"); OptionMapping option = interaction.getOption("link");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a ScoreSaber profile link") .setDescription("Please provide a ScoreSaber profile link")
.build()).queue(); .build()).queue();
return; return;
@ -42,7 +42,7 @@ public class LinkSubCommand extends BatSubCommand {
String link = option.getAsString(); String link = option.getAsString();
if (!link.contains("scoresaber.com/u/")) { if (!link.contains("scoresaber.com/u/")) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid ScoreSaber profile link") .setDescription("Invalid ScoreSaber profile link")
.build()).queue(); .build()).queue();
return; return;
@ -55,7 +55,7 @@ public class LinkSubCommand extends BatSubCommand {
ScoreSaberAccountToken account = scoreSaberService.getAccount(id); ScoreSaberAccountToken account = scoreSaberService.getAccount(id);
if (account == null) { if (account == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Invalid ScoreSaber profile link") .setDescription("Invalid ScoreSaber profile link")
.build()).queue(); .build()).queue();
return; return;
@ -63,7 +63,7 @@ public class LinkSubCommand extends BatSubCommand {
((UserScoreSaberProfile) user.getProfile(UserScoreSaberProfile.class)).setSteamId(id); ((UserScoreSaberProfile) user.getProfile(UserScoreSaberProfile.class)).setSteamId(id);
userService.saveUser(user); userService.saveUser(user);
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.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()).queue();
} }

@ -70,11 +70,11 @@ public class ScoreSaberCommand extends BatCommand {
UserScoreSaberProfile profile = user.getProfile(UserScoreSaberProfile.class); UserScoreSaberProfile profile = user.getProfile(UserScoreSaberProfile.class);
if (profile.getSteamId() == null) { if (profile.getSteamId() == null) {
if (!isSelf) { if (!isSelf) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() 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()).queue();
} }
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() 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()).queue();
return; return;
@ -84,12 +84,12 @@ public class ScoreSaberCommand extends BatCommand {
ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getSteamId()); ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getSteamId());
if (account == null) { if (account == null) {
if (!isSelf) { if (!isSelf) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() 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()).queue();
} }
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() 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()).queue();
return; return;

@ -32,14 +32,14 @@ public class UserSubCommand extends BatSubCommand {
public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) { public void execute(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull TextChannel channel, @NonNull Member member, @NonNull SlashCommandInteraction interaction) {
OptionMapping option = interaction.getOption("user"); OptionMapping option = interaction.getOption("user");
if (option == null) { if (option == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Please provide a user to view the ScoreSaber profile of") .setDescription("Please provide a user to view the ScoreSaber profile of")
.build()).queue(); .build()).queue();
return; return;
} }
if (option.getAsUser().isBot()) { if (option.getAsUser().isBot()) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.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()).queue();
return; return;
@ -47,7 +47,7 @@ public class UserSubCommand extends BatSubCommand {
BatUser target = userService.getUser(option.getAsUser().getId()); BatUser target = userService.getUser(option.getAsUser().getId());
if (target == null) { if (target == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Unknown user") .setDescription("Unknown user")
.build()).queue(); .build()).queue();
return; return;

@ -35,12 +35,12 @@ public class ChannelSubCommand extends BatSubCommand {
OptionMapping option = interaction.getOption("channel"); OptionMapping option = interaction.getOption("channel");
if (option == null) { if (option == null) {
if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) {
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Please provide a channel to set the ScoreSaber feed channel to") .setDescription("Please provide a channel to set the ScoreSaber feed channel to")
.build()).queue(); .build()).queue();
return; return;
} }
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("The current ScoreSaber feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .setDescription("The current ScoreSaber feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId())))
.build()).queue(); .build()).queue();
return; return;
@ -48,7 +48,7 @@ public class ChannelSubCommand extends BatSubCommand {
GuildChannelUnion targetChannel = option.getAsChannel(); GuildChannelUnion targetChannel = option.getAsChannel();
if (targetChannel.getType() != ChannelType.TEXT) { if (targetChannel.getType() != ChannelType.TEXT) {
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Invalid channel type, please provide a text channel") .setDescription("Invalid channel type, please provide a text channel")
.build()).queue(); .build()).queue();
return; return;
@ -57,7 +57,7 @@ public class ChannelSubCommand extends BatSubCommand {
profile.setChannelId(targetChannel.getId()); profile.setChannelId(targetChannel.getId());
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully set the ScoreSaber feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .setDescription("Successfully set the ScoreSaber feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -31,7 +31,7 @@ public class ClearChannelSubCommand extends BatSubCommand {
profile.setChannelId(null); profile.setChannelId(null);
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("Successfully cleared the ScoreSaber feed channel") .setDescription("Successfully cleared the ScoreSaber feed channel")
.build()).queue(); .build()).queue();
} }

@ -31,7 +31,7 @@ public class ClearUsersSubCommand extends BatSubCommand {
profile.getTrackedUsers().clear(); profile.getTrackedUsers().clear();
guildService.saveGuild(guild); guildService.saveGuild(guild);
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully cleared all users from the ScoreSaber feed") .setDescription("Successfully cleared all users from the ScoreSaber feed")
.build()).queue(); .build()).queue();
} }

@ -37,7 +37,7 @@ public class UserSubCommand extends BatSubCommand {
OptionMapping option = interaction.getOption("user"); OptionMapping option = interaction.getOption("user");
if (option == null){ if (option == null){
if (profile.getTrackedUsers().isEmpty()) { if (profile.getTrackedUsers().isEmpty()) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("There are no users being tracked in the ScoreSaber feed") .setDescription("There are no users being tracked in the ScoreSaber feed")
.build()).queue(); .build()).queue();
return; return;
@ -49,7 +49,7 @@ public class UserSubCommand extends BatSubCommand {
"https://scoresaber.com/u/%s".formatted(accountId) "https://scoresaber.com/u/%s".formatted(accountId)
)); ));
} }
interaction.replyEmbeds(EmbedUtils.buildGenericEmbed() interaction.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("The current users being tracked in the ScoreSaber feed are:\n%s".formatted(stringBuilder.toString())) .setDescription("The current users being tracked in the ScoreSaber feed are:\n%s".formatted(stringBuilder.toString()))
.build()).queue(); .build()).queue();
return; return;
@ -59,7 +59,7 @@ public class UserSubCommand extends BatSubCommand {
BatUser targetUser = userService.getUser(target.getId()); BatUser targetUser = userService.getUser(target.getId());
UserScoreSaberProfile targetProfile = targetUser.getProfile(UserScoreSaberProfile.class); UserScoreSaberProfile targetProfile = targetUser.getProfile(UserScoreSaberProfile.class);
if (targetProfile.getSteamId() == null) { if (targetProfile.getSteamId() == null) {
interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The user you are trying to track does not have a linked ScoreSaber profile") .setDescription("The user you are trying to track does not have a linked ScoreSaber profile")
.build()).queue(); .build()).queue();
return; return;
@ -67,12 +67,12 @@ public class UserSubCommand extends BatSubCommand {
if (profile.getTrackedUsers().contains(targetProfile.getSteamId())) { if (profile.getTrackedUsers().contains(targetProfile.getSteamId())) {
profile.getTrackedUsers().remove(targetProfile.getSteamId()); profile.getTrackedUsers().remove(targetProfile.getSteamId());
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully removed %s from the ScoreSaber feed".formatted(target.getAsMention())) .setDescription("Successfully removed %s from the ScoreSaber feed".formatted(target.getAsMention()))
.build()).queue(); .build()).queue();
} else { } else {
profile.getTrackedUsers().add(targetProfile.getSteamId()); profile.getTrackedUsers().add(targetProfile.getSteamId());
interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() interaction.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("Successfully added %s to the ScoreSaber feed".formatted(target.getAsMention())) .setDescription("Successfully added %s to the ScoreSaber feed".formatted(target.getAsMention()))
.build()).queue(); .build()).queue();
} }

@ -130,7 +130,7 @@ public class CommandService extends ListenerAdapter {
} catch (Exception ex) { } catch (Exception ex) {
log.error("An error occurred while executing command \"{}\"", commandName, ex); log.error("An error occurred while executing command \"{}\"", commandName, ex);
event.replyEmbeds(EmbedUtils.buildSuccessEmbed() event.replyEmbeds(EmbedUtils.successEmbed()
.setDescription("An error occurred while executing the command\n\n" + ex.getLocalizedMessage()) .setDescription("An error occurred while executing the command\n\n" + ex.getLocalizedMessage())
.build()).queue(); .build()).queue();
} }