From 519cb72c1491544157beb0ff174779a21554c44f Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 25 Jun 2024 13:59:02 +0100 Subject: [PATCH] more embed cleanup --- src/main/java/cc/fascinated/bat/common/EmbedUtils.java | 6 +++--- .../bat/features/autorole/command/AddSubCommand.java | 9 ++++----- .../bat/features/autorole/command/ClearSubCommand.java | 4 +--- .../bat/features/autorole/command/ListSubCommand.java | 5 ++--- .../features/autorole/command/RemoveSubCommand.java | 6 +++--- .../scoresaber/NumberOneScoreFeedListener.java | 9 ++------- .../bat/features/scoresaber/UserScoreFeedListener.java | 9 ++------- .../command/numberone/ChannelSubCommand.java | 8 ++++---- .../command/numberone/ClearChannelSubCommand.java | 2 +- .../scoresaber/command/scoresaber/LinkSubCommand.java | 8 ++++---- .../command/scoresaber/ScoreSaberCommand.java | 8 ++++---- .../scoresaber/command/scoresaber/UserSubCommand.java | 6 +++--- .../scoresaber/command/userfeed/ChannelSubCommand.java | 8 ++++---- .../command/userfeed/ClearChannelSubCommand.java | 2 +- .../command/userfeed/ClearUsersSubCommand.java | 2 +- .../scoresaber/command/userfeed/UserSubCommand.java | 10 +++++----- .../java/cc/fascinated/bat/service/CommandService.java | 2 +- 17 files changed, 45 insertions(+), 59 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/common/EmbedUtils.java b/src/main/java/cc/fascinated/bat/common/EmbedUtils.java index d084707..5e45621 100644 --- a/src/main/java/cc/fascinated/bat/common/EmbedUtils.java +++ b/src/main/java/cc/fascinated/bat/common/EmbedUtils.java @@ -16,7 +16,7 @@ public class EmbedUtils { * * @return the embed builder */ - public static EmbedBuilder buildGenericEmbed() { + public static EmbedBuilder genericEmbed() { return new EmbedBuilder() .setTimestamp(LocalDateTime.now()) .setColor(Colors.DEFAULT); @@ -27,7 +27,7 @@ public class EmbedUtils { * * @return the embed builder */ - public static EmbedBuilder buildErrorEmbed() { + public static EmbedBuilder errorEmbed() { return new EmbedBuilder() .setTimestamp(LocalDateTime.now()) .setColor(Colors.ERROR); @@ -38,7 +38,7 @@ public class EmbedUtils { * * @return the embed builder */ - public static EmbedBuilder buildSuccessEmbed() { + public static EmbedBuilder successEmbed() { return new EmbedBuilder() .setTimestamp(LocalDateTime.now()) .setColor(Colors.SUCCESS); diff --git a/src/main/java/cc/fascinated/bat/features/autorole/command/AddSubCommand.java b/src/main/java/cc/fascinated/bat/features/autorole/command/AddSubCommand.java index 62b2781..5953e6c 100644 --- a/src/main/java/cc/fascinated/bat/features/autorole/command/AddSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/autorole/command/AddSubCommand.java @@ -7,7 +7,6 @@ import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.GuildService; import lombok.NonNull; -import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; 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) { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); 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" .formatted(profile.getMaxRoles())) .build()).queue(); @@ -41,7 +40,7 @@ public class AddSubCommand extends BatSubCommand { OptionMapping option = interaction.getOption("role"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a role to add") .build()).queue(); return; @@ -49,7 +48,7 @@ public class AddSubCommand extends BatSubCommand { Role role = option.getAsRole(); 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())) .build()).queue(); return; @@ -57,7 +56,7 @@ public class AddSubCommand extends BatSubCommand { profile.addRole(role.getId()); 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())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/autorole/command/ClearSubCommand.java b/src/main/java/cc/fascinated/bat/features/autorole/command/ClearSubCommand.java index 15aa220..f1c3f3a 100644 --- a/src/main/java/cc/fascinated/bat/features/autorole/command/ClearSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/autorole/command/ClearSubCommand.java @@ -8,9 +8,7 @@ import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.service.GuildService; import lombok.NonNull; 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.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -33,7 +31,7 @@ public class ClearSubCommand extends BatSubCommand { profile.clearRoles(); guildService.saveGuild(guild); - interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() + interaction.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully cleared all auto roles") .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/autorole/command/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/autorole/command/ListSubCommand.java index d7377c2..8e0bcae 100644 --- a/src/main/java/cc/fascinated/bat/features/autorole/command/ListSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/autorole/command/ListSubCommand.java @@ -3,7 +3,6 @@ package cc.fascinated.bat.features.autorole.command; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.common.EmbedUtils; 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.BatUser; 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) { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); if (profile.getRoles().isEmpty()) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There are no auto roles set") .build()).queue(); return; @@ -38,7 +37,7 @@ public class ListSubCommand extends BatSubCommand { 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.setDescription(roles.toString()); interaction.replyEmbeds(embed.build()).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/autorole/command/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/autorole/command/RemoveSubCommand.java index 899bedc..d05f59a 100644 --- a/src/main/java/cc/fascinated/bat/features/autorole/command/RemoveSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/autorole/command/RemoveSubCommand.java @@ -32,7 +32,7 @@ public class RemoveSubCommand extends BatSubCommand { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); OptionMapping option = interaction.getOption("role"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a role to remove") .build()).queue(); return; @@ -40,7 +40,7 @@ public class RemoveSubCommand extends BatSubCommand { Role role = option.getAsRole(); 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())) .build()).queue(); return; @@ -48,7 +48,7 @@ public class RemoveSubCommand extends BatSubCommand { profile.removeRole(role.getId()); 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())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/NumberOneScoreFeedListener.java b/src/main/java/cc/fascinated/bat/features/scoresaber/NumberOneScoreFeedListener.java index 4394a56..cd7632a 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/NumberOneScoreFeedListener.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/NumberOneScoreFeedListener.java @@ -1,9 +1,6 @@ package cc.fascinated.bat.features.scoresaber; -import cc.fascinated.bat.common.Colors; -import cc.fascinated.bat.common.DateUtils; -import cc.fascinated.bat.common.NumberUtils; -import cc.fascinated.bat.common.ScoreSaberUtils; +import cc.fascinated.bat.common.*; import cc.fascinated.bat.event.EventListener; import cc.fascinated.bat.features.scoresaber.profile.GuildNumberOneScoreFeedProfile; 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.GuildService; import lombok.extern.log4j.Log4j2; -import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; @@ -74,7 +70,7 @@ public class NumberOneScoreFeedListener implements EventListener { ScoreSaberScoreToken scoreToken = score.getScore(); ScoreSaberLeaderboardToken leaderboardToken = score.getLeaderboard(); 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()), "https://cdn.scoresaber.com/avatars/%s.jpg".formatted(playerInfo.getId())) .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() == leaderboardToken.getMaxScore() ? "(FC)" : "" ), true) - .setColor(Colors.DEFAULT) .setTimestamp(DateUtils.getDateFromString(scoreToken.getTimeSet()).toInstant()) .build(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/UserScoreFeedListener.java b/src/main/java/cc/fascinated/bat/features/scoresaber/UserScoreFeedListener.java index 4711e41..46d8ed8 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/UserScoreFeedListener.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/UserScoreFeedListener.java @@ -1,9 +1,6 @@ package cc.fascinated.bat.features.scoresaber; -import cc.fascinated.bat.common.Colors; -import cc.fascinated.bat.common.DateUtils; -import cc.fascinated.bat.common.NumberUtils; -import cc.fascinated.bat.common.ScoreSaberUtils; +import cc.fascinated.bat.common.*; import cc.fascinated.bat.event.EventListener; import cc.fascinated.bat.features.scoresaber.profile.GuildUserScoreFeedProfile; 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.GuildService; import lombok.extern.log4j.Log4j2; -import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; @@ -67,7 +63,7 @@ public class UserScoreFeedListener implements EventListener { ScoreSaberScoreToken scoreToken = score.getScore(); ScoreSaberLeaderboardToken leaderboardToken = score.getLeaderboard(); 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()), "https://cdn.scoresaber.com/avatars/%s.jpg".formatted(playerInfo.getId())) .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() == leaderboardToken.getMaxScore() ? "(FC)" : "" ), true) - .setColor(Colors.DEFAULT) .setTimestamp(DateUtils.getDateFromString(scoreToken.getTimeSet()).toInstant()) .build(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ChannelSubCommand.java index 71a6648..12e4aea 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ChannelSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ChannelSubCommand.java @@ -35,12 +35,12 @@ public class ChannelSubCommand extends BatSubCommand { OptionMapping option = interaction.getOption("channel"); if (option == null) { 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") .build()).queue(); return; } - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The current ScoreSaber #1 feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .build()).queue(); return; @@ -48,7 +48,7 @@ public class ChannelSubCommand extends BatSubCommand { GuildChannelUnion targetChannel = option.getAsChannel(); if (targetChannel.getType() != ChannelType.TEXT) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid channel type, please provide a text channel") .build()).queue(); return; @@ -57,7 +57,7 @@ public class ChannelSubCommand extends BatSubCommand { profile.setChannelId(targetChannel.getId()); 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())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ClearChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ClearChannelSubCommand.java index 2b38870..d8fdf71 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ClearChannelSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ClearChannelSubCommand.java @@ -31,7 +31,7 @@ public class ClearChannelSubCommand extends BatSubCommand { profile.setChannelId(null); guildService.saveGuild(guild); - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Successfully cleared the ScoreSaber #1 feed channel") .build()).queue(); } 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 4e9aab6..128c99c 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 @@ -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) { OptionMapping option = interaction.getOption("link"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a ScoreSaber profile link") .build()).queue(); return; @@ -42,7 +42,7 @@ public class LinkSubCommand extends BatSubCommand { String link = option.getAsString(); if (!link.contains("scoresaber.com/u/")) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid ScoreSaber profile link") .build()).queue(); return; @@ -55,7 +55,7 @@ public class LinkSubCommand extends BatSubCommand { ScoreSaberAccountToken account = scoreSaberService.getAccount(id); if (account == null) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid ScoreSaber profile link") .build()).queue(); return; @@ -63,7 +63,7 @@ public class LinkSubCommand extends BatSubCommand { ((UserScoreSaberProfile) user.getProfile(UserScoreSaberProfile.class)).setSteamId(id); 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))) .build()).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 585f2bb..cd9263c 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 @@ -70,11 +70,11 @@ public class ScoreSaberCommand extends BatCommand { UserScoreSaberProfile profile = user.getProfile(UserScoreSaberProfile.class); if (profile.getSteamId() == null) { if (!isSelf) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("%s does not have a linked ScoreSaber account".formatted(user.getDiscordUser().getAsMention())) .build()).queue(); } - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You do not have a linked ScoreSaber account") .build()).queue(); return; @@ -84,12 +84,12 @@ public class ScoreSaberCommand extends BatCommand { ScoreSaberAccountToken account = scoreSaberService.getAccount(profile.getSteamId()); if (account == null) { 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" .formatted(user.getDiscordUser().getAsMention())) .build()).queue(); } - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You have an invalid ScoreSaber account linked, please re-link your account") .build()).queue(); return; 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 b977a3f..b648601 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 @@ -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) { OptionMapping option = interaction.getOption("user"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a user to view the ScoreSaber profile of") .build()).queue(); return; } if (option.getAsUser().isBot()) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You cannot view the ScoreSaber profile for a Bot") .build()).queue(); return; @@ -47,7 +47,7 @@ public class UserSubCommand extends BatSubCommand { BatUser target = userService.getUser(option.getAsUser().getId()); if (target == null) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Unknown user") .build()).queue(); return; diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ChannelSubCommand.java index 472b221..fd07eb8 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ChannelSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ChannelSubCommand.java @@ -35,12 +35,12 @@ public class ChannelSubCommand extends BatSubCommand { OptionMapping option = interaction.getOption("channel"); if (option == null) { 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") .build()).queue(); return; } - interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() + interaction.replyEmbeds(EmbedUtils.successEmbed() .setDescription("The current ScoreSaber feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .build()).queue(); return; @@ -48,7 +48,7 @@ public class ChannelSubCommand extends BatSubCommand { GuildChannelUnion targetChannel = option.getAsChannel(); if (targetChannel.getType() != ChannelType.TEXT) { - interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() + interaction.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Invalid channel type, please provide a text channel") .build()).queue(); return; @@ -57,7 +57,7 @@ public class ChannelSubCommand extends BatSubCommand { profile.setChannelId(targetChannel.getId()); guildService.saveGuild(guild); - interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() + interaction.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully set the ScoreSaber feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearChannelSubCommand.java index 465beff..343c513 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearChannelSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearChannelSubCommand.java @@ -31,7 +31,7 @@ public class ClearChannelSubCommand extends BatSubCommand { profile.setChannelId(null); guildService.saveGuild(guild); - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Successfully cleared the ScoreSaber feed channel") .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearUsersSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearUsersSubCommand.java index 7e1bfe8..ae453e7 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearUsersSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ClearUsersSubCommand.java @@ -31,7 +31,7 @@ public class ClearUsersSubCommand extends BatSubCommand { profile.getTrackedUsers().clear(); guildService.saveGuild(guild); - interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() + interaction.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully cleared all users from the ScoreSaber feed") .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/UserSubCommand.java index f331b8a..a48bbfb 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/UserSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/UserSubCommand.java @@ -37,7 +37,7 @@ public class UserSubCommand extends BatSubCommand { OptionMapping option = interaction.getOption("user"); if (option == null){ if (profile.getTrackedUsers().isEmpty()) { - interaction.replyEmbeds(EmbedUtils.buildErrorEmbed() + interaction.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There are no users being tracked in the ScoreSaber feed") .build()).queue(); return; @@ -49,7 +49,7 @@ public class UserSubCommand extends BatSubCommand { "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())) .build()).queue(); return; @@ -59,7 +59,7 @@ public class UserSubCommand extends BatSubCommand { BatUser targetUser = userService.getUser(target.getId()); UserScoreSaberProfile targetProfile = targetUser.getProfile(UserScoreSaberProfile.class); 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") .build()).queue(); return; @@ -67,12 +67,12 @@ public class UserSubCommand extends BatSubCommand { if (profile.getTrackedUsers().contains(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())) .build()).queue(); } else { profile.getTrackedUsers().add(targetProfile.getSteamId()); - interaction.replyEmbeds(EmbedUtils.buildSuccessEmbed() + interaction.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully added %s to the ScoreSaber feed".formatted(target.getAsMention())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index 68fecd6..54d8bc9 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -130,7 +130,7 @@ public class CommandService extends ListenerAdapter { } catch (Exception 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()) .build()).queue(); }