From f2b2dbc7945caed838f5fa0507bdbd45bdb57a33 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 1 Jul 2024 15:27:39 +0100 Subject: [PATCH] rename interaction to event --- .../bat/command/BatCommandExecutor.java | 6 +++--- .../bat/features/afk/command/AfkCommand.java | 6 +++--- .../features/autorole/command/AddSubCommand.java | 16 ++++++++-------- .../autorole/command/ClearSubCommand.java | 4 ++-- .../autorole/command/ListSubCommand.java | 6 +++--- .../autorole/command/RemoveSubCommand.java | 10 +++++----- .../botadmin/premium/RemoveSubCommand.java | 12 ++++++------ .../commands/botadmin/premium/SetSubCommand.java | 16 ++++++++-------- .../base/commands/fun/image/CatSubCommand.java | 6 +++--- .../base/commands/fun/image/DogSubCommand.java | 6 +++--- .../base/commands/fun/image/DuckSubCommand.java | 6 +++--- .../base/commands/fun/image/FoxSubCommand.java | 6 +++--- .../base/commands/general/BotStatsCommand.java | 4 ++-- .../base/commands/general/HelpCommand.java | 4 ++-- .../base/commands/general/InviteCommand.java | 4 ++-- .../base/commands/general/PingCommand.java | 4 ++-- .../base/commands/general/VoteCommand.java | 4 ++-- .../commands/general/avatar/GuildSubCommand.java | 6 +++--- .../commands/general/avatar/UserSubCommand.java | 8 ++++---- .../commands/general/banner/GuildSubCommand.java | 6 +++--- .../commands/general/banner/UserSubCommand.java | 10 +++++----- .../base/commands/server/MemberCountCommand.java | 4 ++-- .../base/commands/server/PremiumCommand.java | 4 ++-- .../server/channel/RemoveTopicSubCommand.java | 10 +++++----- .../server/channel/SetTopicSubCommand.java | 12 ++++++------ .../server/channel/ViewTopicSubCommand.java | 10 +++++----- .../server/feature/DisableSubCommand.java | 12 ++++++------ .../server/feature/EnableSubCommand.java | 12 ++++++------ .../commands/server/feature/ListSubCommand.java | 4 ++-- .../birthday/command/ChannelSubCommand.java | 12 ++++++------ .../birthday/command/MessageSubCommand.java | 12 ++++++------ .../birthday/command/PrivateSubCommand.java | 10 +++++----- .../birthday/command/RemoveSubCommand.java | 4 ++-- .../features/birthday/command/SetSubCommand.java | 12 ++++++------ .../birthday/command/ViewSubCommand.java | 14 +++++++------- .../namehistory/command/GuildSubCommand.java | 6 +++--- .../namehistory/command/UserSubCommand.java | 6 +++--- .../command/numberone/ChannelSubCommand.java | 12 ++++++------ .../command/numberone/ResetSubCommand.java | 4 ++-- .../command/scoresaber/LinkSubCommand.java | 12 ++++++------ .../command/scoresaber/MeSubCommand.java | 4 ++-- .../command/scoresaber/ResetSubCommand.java | 4 ++-- .../command/scoresaber/ScoreSaberCommand.java | 4 ++-- .../command/scoresaber/UserSubCommand.java | 12 ++++++------ .../command/userfeed/ChannelSubCommand.java | 12 ++++++------ .../command/userfeed/ResetSubCommand.java | 4 ++-- .../command/userfeed/UserSubCommand.java | 12 ++++++------ .../spotify/command/CurrentSubCommand.java | 4 ++-- .../features/spotify/command/LinkSubCommand.java | 4 ++-- .../spotify/command/PauseSubCommand.java | 4 ++-- .../spotify/command/ResumeSubCommand.java | 4 ++-- .../features/spotify/command/SkipSubCommand.java | 4 ++-- .../spotify/command/UnlinkSubCommand.java | 4 ++-- 53 files changed, 199 insertions(+), 199 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/command/BatCommandExecutor.java b/src/main/java/cc/fascinated/bat/command/BatCommandExecutor.java index 613ba83..cac1815 100644 --- a/src/main/java/cc/fascinated/bat/command/BatCommandExecutor.java +++ b/src/main/java/cc/fascinated/bat/command/BatCommandExecutor.java @@ -12,20 +12,20 @@ import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; */ public interface BatCommandExecutor { /** - * Executes the command using a slash command interaction. + * Executes the command using a slash command event. * * @param guild the bat guild the command was executed in (null if the command was executed in a DM) * @param user the bat user that executed the command * @param channel the channel the command was executed in * @param member the member that executed the command - * @param interaction the slash command interaction + * @param event the slash command event */ default void execute( BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, - @NonNull SlashCommandInteraction interaction + @NonNull SlashCommandInteraction event ) { } } diff --git a/src/main/java/cc/fascinated/bat/features/afk/command/AfkCommand.java b/src/main/java/cc/fascinated/bat/features/afk/command/AfkCommand.java index cd27a09..bf52eeb 100644 --- a/src/main/java/cc/fascinated/bat/features/afk/command/AfkCommand.java +++ b/src/main/java/cc/fascinated/bat/features/afk/command/AfkCommand.java @@ -25,16 +25,16 @@ public class AfkCommand extends BatCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { AfkProfile profile = guild.getProfile(AfkProfile.class); String reason = null; - OptionMapping reasonOption = interaction.getOption("reason"); + OptionMapping reasonOption = event.getOption("reason"); if (reasonOption != null) { reason = reasonOption.getAsString(); } profile.addAfkUser(guild, member.getId(), reason); - interaction.reply("You are now AFK: %s%s".formatted( + event.reply("You are now AFK: %s%s".formatted( profile.getAfkReason(member.getId()), MemberUtils.hasPermissionToEdit(guild, user) ? "" : "\n\n*I do not have enough permissions to edit your user, and therefore cannot update your nickname*" 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 7338752..2f3cb7d 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 @@ -29,21 +29,21 @@ public class AddSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); // Check if the guild has reached the maximum auto roles count int maxRoleSlots = AutoRoleProfile.getMaxRoleSlots(guild); if (profile.getRoleSlotsInUse() >= maxRoleSlots) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The guild can only have a maximum of %d auto roles" .formatted(maxRoleSlots)) .build()).queue(); return; } - OptionMapping option = interaction.getOption("role"); + OptionMapping option = event.getOption("role"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a role to add") .build()).queue(); return; @@ -52,7 +52,7 @@ public class AddSubCommand extends BatSubCommand { // Check if the role is already in the auto roles list if (profile.hasRole(role.getId())) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The role %s is already in the auto roles list".formatted(role.getAsMention())) .build()).queue(); return; @@ -60,7 +60,7 @@ public class AddSubCommand extends BatSubCommand { // Check if the bot has permission to give the role if (!RoleUtils.hasPermissionToGiveRole(guild, guild.getDiscordGuild().getSelfMember(), role)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("I do not have permission to give the role %s".formatted(role.getAsMention())) .build()).queue(); return; @@ -68,7 +68,7 @@ public class AddSubCommand extends BatSubCommand { // Check if the role is higher than the user adding the role if (!RoleUtils.hasPermissionToGiveRole(guild, member, role)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You cannot add a role that is higher than you") .build()).queue(); return; @@ -76,7 +76,7 @@ public class AddSubCommand extends BatSubCommand { // Add the role to the auto roles list profile.addRole(role.getId()); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("You have added %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 1ed1526..cc40347 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 @@ -19,11 +19,11 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "clear", description = "Clears all auto roles") public class ClearSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); profile.reset(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.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 f6050a6..69cdd12 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 @@ -20,10 +20,10 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "list", description = "Lists all auto roles") public class ListSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); if (profile.getRoles().isEmpty()) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There are no auto roles set") .build()).queue(); return; @@ -41,6 +41,6 @@ public class ListSubCommand extends BatSubCommand { EmbedBuilder embed = EmbedUtils.genericEmbed(); embed.setAuthor("Auto Role List"); embed.setDescription(roles.toString()); - interaction.replyEmbeds(embed.build()).queue(); + event.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 98ed6fe..1b82449 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 @@ -28,11 +28,11 @@ public class RemoveSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class); - OptionMapping option = interaction.getOption("role"); + OptionMapping option = event.getOption("role"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a role to remove") .build()).queue(); return; @@ -40,14 +40,14 @@ public class RemoveSubCommand extends BatSubCommand { Role role = option.getAsRole(); if (!profile.hasRole(role.getId())) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The role %s is not in the auto roles list".formatted(role.getAsMention())) .build()).queue(); return; } profile.removeRole(role.getId()); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .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/base/commands/botadmin/premium/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/RemoveSubCommand.java index 5c5052e..70dfcb1 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/RemoveSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/RemoveSubCommand.java @@ -30,25 +30,25 @@ public class RemoveSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping guildOption = interaction.getOption("guild"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping guildOption = event.getOption("guild"); if (guildOption == null) { - interaction.reply("Please provide a guild id").queue(); + event.reply("Please provide a guild id").queue(); return; } String guildId = guildOption.getAsString(); BatGuild targetGuild = guildService.getGuild(guildId); if (targetGuild == null) { - interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue(); + event.reply("The guild with the id %s does not exist".formatted(guildId)).queue(); return; } PremiumProfile premium = targetGuild.getPremiumProfile(); if (!premium.hasPremium()) { - interaction.reply("The guild does not have premium").queue(); + event.reply("The guild does not have premium").queue(); return; } premium.removePremium(); - interaction.reply("The guild **%s** has had its premium removed".formatted(targetGuild.getName())).queue(); + event.reply("The guild **%s** has had its premium removed".formatted(targetGuild.getName())).queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/SetSubCommand.java index 4785e54..917e02a 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/SetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/SetSubCommand.java @@ -31,23 +31,23 @@ public class SetSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping guildOption = interaction.getOption("guild"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping guildOption = event.getOption("guild"); if (guildOption == null) { - interaction.reply("Please provide a guild id").queue(); + event.reply("Please provide a guild id").queue(); return; } String guildId = guildOption.getAsString(); - OptionMapping infiniteOption = interaction.getOption("infinite"); + OptionMapping infiniteOption = event.getOption("infinite"); if (infiniteOption == null) { - interaction.reply("Please provide whether the premium length should be infinite").queue(); + event.reply("Please provide whether the premium length should be infinite").queue(); return; } boolean infinite = infiniteOption.getAsBoolean(); BatGuild targetGuild = guildService.getGuild(guildId); if (targetGuild == null) { - interaction.reply("The guild with the id %s does not exist".formatted(guildId)).queue(); + event.reply("The guild with the id %s does not exist".formatted(guildId)).queue(); return; } PremiumProfile premium = targetGuild.getPremiumProfile(); @@ -57,9 +57,9 @@ public class SetSubCommand extends BatSubCommand { premium.addInfiniteTime(); } if (!infinite) { - interaction.reply("The guild **%s** has been set as premium until ".formatted(targetGuild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue(); + event.reply("The guild **%s** has been set as premium until ".formatted(targetGuild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue(); } else { - interaction.reply("The guild **%s** has been set as premium indefinitely".formatted(targetGuild.getName())).queue(); + event.reply("The guild **%s** has been set as premium indefinitely".formatted(targetGuild.getName())).queue(); } } } diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/CatSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/CatSubCommand.java index ff9764e..b5616e1 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/CatSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/CatSubCommand.java @@ -20,14 +20,14 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "cat", description = "Get a random cat image") public class CatSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { CatImageToken[] responseEntity = WebRequest.getAsEntity("https://api.thecatapi.com/v1/images/search", CatImageToken[].class); if (responseEntity == null || responseEntity.length == 0) { - interaction.reply("Failed to get a cat image!").queue(); + event.reply("Failed to get a cat image!").queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("Here's a random cat image!") .setImage(responseEntity[0].getUrl()) .build()).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DogSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DogSubCommand.java index c66935d..79973d8 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DogSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DogSubCommand.java @@ -20,14 +20,14 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "dog", description = "Get a random dog image") public class DogSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { RandomImage responseEntity = WebRequest.getAsEntity("https://dog.ceo/api/breeds/image/random", RandomImage.class); if (responseEntity == null) { - interaction.reply("Failed to get a dog image!").queue(); + event.reply("Failed to get a dog image!").queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("Here's a random dog image!") .setImage(responseEntity.getMessage()) .build()).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DuckSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DuckSubCommand.java index a849e3a..c610d0b 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DuckSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/DuckSubCommand.java @@ -20,14 +20,14 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "duck", description = "Get a random duck image") public class DuckSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { RandomDuck responseEntity = WebRequest.getAsEntity("https://random-d.uk/api/v2/random", RandomDuck.class); if (responseEntity == null) { - interaction.reply("Failed to get a duck image!").queue(); + event.reply("Failed to get a duck image!").queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("Here's a random duck image!") .setImage(responseEntity.getUrl()) .build()).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/FoxSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/FoxSubCommand.java index d1d67ec..f8f063e 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/FoxSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/image/FoxSubCommand.java @@ -20,14 +20,14 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "fox", description = "Get a random fox image") public class FoxSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { RandomFoxToken responseEntity = WebRequest.getAsEntity("https://randomfox.ca/floof/", RandomFoxToken.class); if (responseEntity == null) { - interaction.reply("Failed to get a fox image!").queue(); + event.reply("Failed to get a fox image!").queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("Here's a random fox image!") .setImage(responseEntity.getImage()) .build()).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/BotStatsCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/BotStatsCommand.java index 726cb6e..5a4a804 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/BotStatsCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/BotStatsCommand.java @@ -38,10 +38,10 @@ public class BotStatsCommand extends BatCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { JDA jda = DiscordService.JDA; - interaction.replyEmbeds(EmbedUtils.genericEmbed().setDescription( + event.replyEmbeds(EmbedUtils.genericEmbed().setDescription( "**Bot Statistics**\n" + "➜ Guilds: **%s**\n".formatted(NumberFormatter.format(jda.getGuilds().size())) + "➜ Users: **%s**\n".formatted(NumberFormatter.format(jda.getUsers().size())) + diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java index 1586385..af95938 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java @@ -45,8 +45,8 @@ public class HelpCommand extends BatCommand implements EventListener { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - interaction.replyEmbeds(createHomeEmbed()).addComponents(createHomeActions()).queue(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + event.replyEmbeds(createHomeEmbed()).addComponents(createHomeActions()).queue(); } @Override diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/InviteCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/InviteCommand.java index acfed21..bc78ecb 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/InviteCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/InviteCommand.java @@ -19,8 +19,8 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false) public class InviteCommand extends BatCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - interaction.replyEmbeds(EmbedUtils.genericEmbed() + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("You can invite the bot to your server by clicking [here](%s)".formatted(Consts.INVITE_URL)) .build()) .setEphemeral(true) diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/PingCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/PingCommand.java index a8a48ad..760ef35 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/PingCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/PingCommand.java @@ -18,9 +18,9 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false) public class PingCommand extends BatCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { long time = System.currentTimeMillis(); - interaction.reply("Pinging...").queue(response -> { + event.reply("Pinging...").queue(response -> { response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted( DiscordService.JDA.getGatewayPing(), System.currentTimeMillis() - time diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java index d5fef0a..aac169a 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/VoteCommand.java @@ -22,13 +22,13 @@ public class VoteCommand extends BatCommand { }; @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { StringBuilder builder = new StringBuilder(); builder.append("You can vote for the bot by clicking the following links:\n\n"); for (String link : VOTE_LINKS) { builder.append("%s\n".formatted(link)); } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription(builder.toString()) .build() ).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/GuildSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/GuildSubCommand.java index 4bafd7d..eaf9952 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/GuildSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/GuildSubCommand.java @@ -19,18 +19,18 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "guild", description = "View the avatar of the guild") public class GuildSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { ImageProxy icon = guild.getDiscordGuild().getIcon(); if (icon == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("**%s** does not have an avatar!".formatted(guild.getName())) .build()) .queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("%s's Avatar".formatted(guild.getName()), null, guild.getDiscordGuild().getIconUrl()) .setImage(icon.getUrl(4096)) .build() diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/UserSubCommand.java index faf01f1..06c099d 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/UserSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/avatar/UserSubCommand.java @@ -25,10 +25,10 @@ public class UserSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping userOption = interaction.getOption("user"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping userOption = event.getOption("user"); if (userOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a user to view the avatar of!") .build()) .queue(); @@ -36,7 +36,7 @@ public class UserSubCommand extends BatSubCommand { } User target = userOption.getAsUser(); - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("%s's Avatar".formatted(target.getName()), null, target.getEffectiveAvatarUrl()) .setImage(target.getEffectiveAvatarUrl()) .build() diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/GuildSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/GuildSubCommand.java index c828c47..a34c48b 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/GuildSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/GuildSubCommand.java @@ -19,17 +19,17 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "guild", description = "View the banner of the guild") public class GuildSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { ImageProxy banner = guild.getDiscordGuild().getBanner(); if (banner == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("**%s** does not have a banner!".formatted(guild.getName())) .build()) .queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("%s's Banner".formatted(guild.getName())) .setImage(banner.getUrl(512)) .build() diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/UserSubCommand.java index c0e2137..abff18a 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/UserSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/banner/UserSubCommand.java @@ -26,10 +26,10 @@ public class UserSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping userOption = interaction.getOption("user"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping userOption = event.getOption("user"); if (userOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a user to view the banner of!") .build()) .queue(); @@ -39,14 +39,14 @@ public class UserSubCommand extends BatSubCommand { User target = userOption.getAsUser(); ImageProxy banner = target.retrieveProfile().complete().getBanner(); if (banner == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("**%s** does not have a banner!".formatted(target.getName())) .build()) .queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("%s's Banner".formatted(target.getName())) .setImage(banner.getUrl(512)) .build() diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/MemberCountCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/MemberCountCommand.java index e26175e..18d4523 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/MemberCountCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/MemberCountCommand.java @@ -26,7 +26,7 @@ import java.util.Map; @CommandInfo(name = "membercount", description = "View the member count of the server!") public class MemberCountCommand extends BatCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { Guild discordGuild = guild.getDiscordGuild(); int totalMembers = 0, totalUsers = 0, totalBots = 0; Map memberCounts = new HashMap<>(); @@ -41,7 +41,7 @@ public class MemberCountCommand extends BatCommand { } totalMembers++; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription(""" **Member Count** Total Members: `%s` diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java index d76f2db..544357f 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/PremiumCommand.java @@ -21,7 +21,7 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "premium", description = "View the premium information for the guild", requiredPermissions = Permission.ADMINISTRATOR) public class PremiumCommand extends BatCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { PremiumProfile premium = guild.getPremiumProfile(); EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information"); if (premium.hasPremium()) { @@ -32,6 +32,6 @@ public class PremiumCommand extends BatCommand { } else { embed.setDescription("The guild does not have premium"); } - interaction.replyEmbeds(embed.build()).queue(); + event.replyEmbeds(embed.build()).queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/RemoveTopicSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/RemoveTopicSubCommand.java index e1e9913..ebd54a9 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/RemoveTopicSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/RemoveTopicSubCommand.java @@ -26,10 +26,10 @@ public class RemoveTopicSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - Channel target = interaction.getOption("channel") == null ? channel : interaction.getOption("channel").getAsChannel(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel(); if (!(target instanceof TextChannel textChannel)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("<#%s> is not a text channel!".formatted(target.getId())) .build()) .queue(); @@ -37,7 +37,7 @@ public class RemoveTopicSubCommand extends BatSubCommand { } if (textChannel.getTopic() == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("<#%s> does not have a topic!".formatted(textChannel.getId())) .build()) .queue(); @@ -45,7 +45,7 @@ public class RemoveTopicSubCommand extends BatSubCommand { } textChannel.getManager().setTopic(null).queue(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully removed the topic of <#%s>".formatted(textChannel.getId())) .build() ).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java index 475fa12..c04f5e5 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java @@ -27,19 +27,19 @@ public class SetTopicSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - Channel target = interaction.getOption("channel") == null ? channel : interaction.getOption("channel").getAsChannel(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel(); if (!(target instanceof TextChannel textChannel)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("<#%s> is not a text channel!".formatted(target.getId())) .build()) .queue(); return; } - String topic = interaction.getOption("topic").getAsString(); + String topic = event.getOption("topic").getAsString(); if (topic.length() > 1024) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The topic must be 1024 characters or less!") .build()) .queue(); @@ -47,7 +47,7 @@ public class SetTopicSubCommand extends BatSubCommand { } textChannel.getManager().setTopic(topic).queue(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully set the topic of <#%s> to: \"%s\"".formatted(textChannel.getId(), topic)) .build() ).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/ViewTopicSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/ViewTopicSubCommand.java index d04e0c1..c0ee574 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/ViewTopicSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/ViewTopicSubCommand.java @@ -25,10 +25,10 @@ public class ViewTopicSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - Channel target = interaction.getOption("channel") == null ? channel : interaction.getOption("channel").getAsChannel(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel(); if (!(target instanceof TextChannel textChannel)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("<#%s> is not a text channel!".formatted(target.getId())) .build()) .queue(); @@ -37,14 +37,14 @@ public class ViewTopicSubCommand extends BatSubCommand { String topic = textChannel.getTopic(); if (topic == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("<#%s> does not have a topic!".formatted(textChannel.getId())) .build()) .queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("The topic of <#%s> is: \"%s\"".formatted(textChannel.getId(), topic)) .build() ).queue(); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/DisableSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/DisableSubCommand.java index e7e1da7..aacb790 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/DisableSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/DisableSubCommand.java @@ -29,32 +29,32 @@ public class DisableSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { FeatureProfile featureProfile = guild.getFeatureProfile(); - OptionMapping featureOption = interaction.getOption("feature"); + OptionMapping featureOption = event.getOption("feature"); if (featureOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a feature to enabled") .build()).queue(); return; } String featureName = featureOption.getAsString(); if (!FeatureService.INSTANCE.isFeature(featureName)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("That feature does not exist") .build()).queue(); return; } Feature feature = FeatureService.INSTANCE.getFeature(featureName); if (featureProfile.isFeatureDisabled(feature)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The feature `%s` is already disabled".formatted(feature.getName())) .build()).queue(); return; } featureProfile.disableFeature(feature); - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Successfully disabled the `%s` feature".formatted(feature.getName())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/EnableSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/EnableSubCommand.java index 8e9e860..316c05a 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/EnableSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/EnableSubCommand.java @@ -29,32 +29,32 @@ public class EnableSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { FeatureProfile featureProfile = guild.getFeatureProfile(); - OptionMapping featureOption = interaction.getOption("feature"); + OptionMapping featureOption = event.getOption("feature"); if (featureOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a feature to enabled") .build()).queue(); return; } String featureName = featureOption.getAsString(); if (!FeatureService.INSTANCE.isFeature(featureName)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("That feature does not exist") .build()).queue(); return; } Feature feature = FeatureService.INSTANCE.getFeature(featureName); if (featureProfile.isFeatureEnabled(feature)) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The feature `%s` is already enabled".formatted(feature.getName())) .build()).queue(); return; } featureProfile.enableFeature(feature); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully enabled the `%s` feature".formatted(feature.getName())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/ListSubCommand.java index a7124f4..f5cbbcb 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/ListSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/feature/ListSubCommand.java @@ -21,7 +21,7 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "list", description = "Lists the features and their states") public class ListSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { StringBuilder featureStates = new StringBuilder(); for (Feature feature : FeatureService.INSTANCE.getFeaturesSorted()) { FeatureProfile featureProfile = guild.getFeatureProfile(); @@ -30,7 +30,7 @@ public class ListSubCommand extends BatSubCommand { feature.getName() )); } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setTitle("Feature List") .setDescription(featureStates.toString()) .build() diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/ChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/ChannelSubCommand.java index 584c027..f0eeec9 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/ChannelSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/ChannelSubCommand.java @@ -31,17 +31,17 @@ public class ChannelSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { BirthdayProfile profile = guild.getBirthdayProfile(); - OptionMapping option = interaction.getOption("channel"); + OptionMapping option = event.getOption("channel"); if (option == null) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There is no channel set for birthday notifications. Please provide a channel to set the birthday channel to") .build()).queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("The current birthday channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .build()).queue(); return; @@ -49,14 +49,14 @@ public class ChannelSubCommand extends BatSubCommand { GuildChannelUnion targetChannel = option.getAsChannel(); if (targetChannel.getType() != ChannelType.TEXT) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid channel type, please provide a text channel") .build()).queue(); return; } profile.setChannelId(targetChannel.getId()); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully set the birthday channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/MessageSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/MessageSubCommand.java index e848fae..3f4a8f5 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/MessageSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/MessageSubCommand.java @@ -29,11 +29,11 @@ public class MessageSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { BirthdayProfile profile = guild.getBirthdayProfile(); - OptionMapping messageOption = interaction.getOption("message"); + OptionMapping messageOption = event.getOption("message"); if (messageOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a message") .build()).queue(); return; @@ -41,20 +41,20 @@ public class MessageSubCommand extends BatSubCommand { String message = messageOption.getAsString(); if (message.length() > 2000) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The message must be less than 2000 characters") .build()).queue(); return; } if (!message.contains("{user}") || !message.contains("{age}")) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The message must contain the placeholders {user} and {age}") .build()).queue(); return; } profile.setMessage(message); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("You have updated the birthday message!\n\n**Message:** %s".formatted(profile.getBirthdayMessage(user.getDiscordUser()))) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java index 12ca99f..abdc3ab 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/PrivateSubCommand.java @@ -29,11 +29,11 @@ public class PrivateSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { BirthdayProfile profile = guild.getBirthdayProfile(); - OptionMapping enabledOption = interaction.getOption("enabled"); + OptionMapping enabledOption = event.getOption("enabled"); if (enabledOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide whether your birthday is private or not") .build()).queue(); return; @@ -42,14 +42,14 @@ public class PrivateSubCommand extends BatSubCommand { boolean enabled = enabledOption.getAsBoolean(); UserBirthday birthday = profile.getBirthday(user.getId()); if (birthday == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You have not set your birthday yet") .build()).queue(); return; } birthday.setHidden(enabled); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Your birthday privacy settings have been updated\n\n**Private:** " + (enabled ? "Yes" : "No")) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/RemoveSubCommand.java index 12246c3..fdfd0c8 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/RemoveSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/RemoveSubCommand.java @@ -20,11 +20,11 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "remove", description = "Remove your birthday from this guild") public class RemoveSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { BirthdayProfile profile = guild.getBirthdayProfile(); profile.removeBirthday(user.getId()); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Your birthday has been removed from this guild") .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java index 8edab74..43e91bb 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/SetSubCommand.java @@ -35,18 +35,18 @@ public class SetSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { BirthdayProfile profile = guild.getBirthdayProfile(); if (!profile.hasChannelSetup()) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.") .build()).queue(); return; } - OptionMapping birthdayOption = interaction.getOption("birthday"); + OptionMapping birthdayOption = event.getOption("birthday"); if (birthdayOption == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a birthday") .build()).queue(); return; @@ -54,7 +54,7 @@ public class SetSubCommand extends BatSubCommand { String birthdayString = birthdayOption.getAsString(); Date birthday = parseBirthday(birthdayString); if (birthday == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription(""" Invalid birthday format. Please use the following format: DAY/MONTH/YEAR - 01/05/2004 @@ -67,7 +67,7 @@ public class SetSubCommand extends BatSubCommand { userBirthday.setBirthday(birthday); userBirthday.setHidden(false); profile.addBirthday(member.getId(), userBirthday); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("You have updated your birthday!") .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java b/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java index eb68c0f..45c245c 100644 --- a/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/birthday/command/ViewSubCommand.java @@ -33,38 +33,38 @@ public class ViewSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { BirthdayProfile profile = guild.getBirthdayProfile(); if (!profile.hasChannelSetup()) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Birthdays have not been enabled in this guild. Please ask an administrator to enable them.") .build()).queue(); return; } - OptionMapping birthdayOption = interaction.getOption("user"); + OptionMapping birthdayOption = event.getOption("user"); BatUser target = birthdayOption == null ? user : userService.getUser(birthdayOption.getAsUser().getId()); if (target == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You must provide a valid user") .build()).queue(); return; } UserBirthday birthday = profile.getBirthday(target.getId()); if (birthday == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("%s does not have a birthday set".formatted(target.getDiscordUser().getAsMention())) .build()).queue(); return; } if (birthday.isHidden() && !user.getId().equals(target.getId())) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("%s has their birthday set to private".formatted(target.getDiscordUser().getAsMention())) .build()).queue(); return; } - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("%s was born on they are `%s` years old!".formatted( target.getDiscordUser().getAsMention(), birthday.getBirthday().toInstant().toEpochMilli()/1000, birthday.calculateAge() diff --git a/src/main/java/cc/fascinated/bat/features/namehistory/command/GuildSubCommand.java b/src/main/java/cc/fascinated/bat/features/namehistory/command/GuildSubCommand.java index 9802f3b..62625cf 100644 --- a/src/main/java/cc/fascinated/bat/features/namehistory/command/GuildSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/namehistory/command/GuildSubCommand.java @@ -32,8 +32,8 @@ public class GuildSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping userOption = interaction.getOption("user"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping userOption = event.getOption("user"); BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId()); if (target == null) { channel.sendMessage("User not found").queue(); @@ -53,7 +53,7 @@ public class GuildSubCommand extends BatSubCommand { } } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("%s's Nickname History in %s".formatted(target.getName(), guild.getName())) .setDescription(builder.toString()) .build() diff --git a/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java index 70bd8c9..27143ca 100644 --- a/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/namehistory/command/UserSubCommand.java @@ -32,8 +32,8 @@ public class UserSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping userOption = interaction.getOption("user"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping userOption = event.getOption("user"); BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId()); if (target == null) { channel.sendMessage("User not found").queue(); @@ -50,7 +50,7 @@ public class UserSubCommand extends BatSubCommand { } } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setAuthor("%s's Global Name History".formatted(target.getName())) .setDescription(builder.toString()) .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 b11ae85..ef4867e 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 @@ -30,17 +30,17 @@ public class ChannelSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class); - OptionMapping option = interaction.getOption("channel"); + OptionMapping option = event.getOption("channel"); if (option == null) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There is no channel set for the feed notifications.") .build()).queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("The current feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .build()).queue(); return; @@ -48,14 +48,14 @@ public class ChannelSubCommand extends BatSubCommand { GuildChannelUnion targetChannel = option.getAsChannel(); if (targetChannel.getType() != ChannelType.TEXT) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid channel type, please provide a text channel") .build()).queue(); return; } profile.setChannelId(targetChannel.getId()); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully set the feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ResetSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ResetSubCommand.java index 0ea1c1a..bbadaff 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ResetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/numberone/ResetSubCommand.java @@ -19,11 +19,11 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "reset", description = "Resets the settings") public class ResetSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class); profile.reset(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully reset the settings.") .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 1c5d0bc..f876819 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 @@ -31,10 +31,10 @@ public class LinkSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping option = interaction.getOption("link"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping option = event.getOption("link"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.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.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid ScoreSaber profile link") .build()).queue(); return; @@ -55,14 +55,14 @@ public class LinkSubCommand extends BatSubCommand { ScoreSaberAccountToken account = scoreSaberService.getAccount(id); if (account == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid ScoreSaber profile link") .build()).queue(); return; } user.getScoreSaberProfile().setAccountId(id); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.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/MeSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/MeSubCommand.java index bf03843..187236e 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/MeSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/MeSubCommand.java @@ -26,7 +26,7 @@ public class MeSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - ScoreSaberCommand.sendProfileEmbed(true, user, scoreSaberService, interaction); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + ScoreSaberCommand.sendProfileEmbed(true, user, scoreSaberService, event); } } 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 d655e98..e8f6674 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 @@ -19,11 +19,11 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "reset", description = "Reset your settings") public class ResetSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { ScoreSaberProfile profile = user.getScoreSaberProfile(); profile.reset(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully reset your settings.") .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 ae50353..2126b38 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 @@ -100,7 +100,7 @@ public class ScoreSaberCommand extends BatCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - sendProfileEmbed(true, user, scoreSaberService, interaction); + 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 fdad10b..1a7f9ab 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 @@ -33,17 +33,17 @@ public class UserSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - OptionMapping option = interaction.getOption("user"); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + OptionMapping option = event.getOption("user"); if (option == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Please provide a user to view the ScoreSaber profile of") .build()).queue(); return; } if (option.getAsUser().isBot()) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("You cannot view the ScoreSaber profile for a Bot") .build()).queue(); return; @@ -51,11 +51,11 @@ public class UserSubCommand extends BatSubCommand { BatUser target = userService.getUser(option.getAsUser().getId()); if (target == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Unknown user") .build()).queue(); return; } - ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, interaction); + ScoreSaberCommand.sendProfileEmbed(false, target, scoreSaberService, event); } } 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 4566791..b2746bf 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 @@ -30,17 +30,17 @@ public class ChannelSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class); - OptionMapping option = interaction.getOption("channel"); + OptionMapping option = event.getOption("channel"); if (option == null) { if (!TextChannelUtils.isValidChannel(profile.getChannelId())) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There is no channel set for the feed notifications.") .build()).queue(); return; } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("The current feed channel is %s".formatted(TextChannelUtils.getChannelMention(profile.getChannelId()))) .build()).queue(); return; @@ -48,14 +48,14 @@ public class ChannelSubCommand extends BatSubCommand { GuildChannelUnion targetChannel = option.getAsChannel(); if (targetChannel.getType() != ChannelType.TEXT) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("Invalid channel type, please provide a text channel") .build()).queue(); return; } profile.setChannelId(targetChannel.getId()); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully set the feed channel to %s".formatted(targetChannel.asTextChannel().getAsMention())) .build()).queue(); } diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ResetSubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ResetSubCommand.java index fd39d1d..f97917f 100644 --- a/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ResetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/userfeed/ResetSubCommand.java @@ -19,10 +19,10 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "reset", description = "Resets the settings") public class ResetSubCommand extends BatSubCommand { @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class); profile.reset(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully reset the settings.") .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 02579a2..9c08376 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 @@ -36,12 +36,12 @@ public class UserSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class); - OptionMapping option = interaction.getOption("user"); + OptionMapping option = event.getOption("user"); if (option == null) { if (profile.getTrackedUsers().isEmpty()) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("There are no users being tracked in the feed") .build()).queue(); return; @@ -53,7 +53,7 @@ public class UserSubCommand extends BatSubCommand { "https://scoresaber.com/u/%s".formatted(accountId) )); } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("The current users being tracked in the feed are:\n%s".formatted(stringBuilder.toString())) .build()).queue(); return; @@ -63,7 +63,7 @@ public class UserSubCommand extends BatSubCommand { BatUser targetUser = userService.getUser(target.getId()); ScoreSaberProfile targetProfile = targetUser.getScoreSaberProfile(); if (targetProfile.getAccountId() == null) { - interaction.replyEmbeds(EmbedUtils.errorEmbed() + event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("The user you are trying to track does not have a linked ScoreSaber profile") .build()).queue(); return; @@ -77,7 +77,7 @@ public class UserSubCommand extends BatSubCommand { added = true; } - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully %s %s from the feed".formatted( added ? "added" : "removed", target.getAsMention() diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java index d258f20..f9267d9 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/CurrentSubCommand.java @@ -39,8 +39,8 @@ public class CurrentSubCommand extends BatSubCommand implements EventListener { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - interaction.replyEmbeds(SpotifyFeature.currentSong(spotifyService, user).build()).addComponents(createActions()).queue(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + event.replyEmbeds(SpotifyFeature.currentSong(spotifyService, user).build()).addComponents(createActions()).queue(); } @Override @SneakyThrows diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/LinkSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/LinkSubCommand.java index 1a8ea40..9be3303 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/LinkSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/LinkSubCommand.java @@ -41,7 +41,7 @@ public class LinkSubCommand extends BatSubCommand implements EventListener { } @Override @SneakyThrows - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { if (!user.getId().equals(Consts.BOT_OWNER)) { throw new BatException(""" %s We are currently awaiting Spotify's approval for our application. Please check back later. @@ -53,7 +53,7 @@ public class LinkSubCommand extends BatSubCommand implements EventListener { throw new BatException("%s You have already linked your Spotify account.".formatted(Emojis.CROSS_MARK_EMOJI)); } - interaction.replyEmbeds(EmbedUtils.genericEmbed() + event.replyEmbeds(EmbedUtils.genericEmbed() .setDescription("%s You can link your Spotify account by clicking [here](%s)".formatted( Emojis.SPOTIFY_EMOJI.getFormatted(), spotifyService.getAuthorizationUrl() diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java index f0b601c..6a606ed 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/PauseSubCommand.java @@ -27,7 +27,7 @@ public class PauseSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - interaction.replyEmbeds(SpotifyFeature.pauseSong(spotifyService, user).build()).queue(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + event.replyEmbeds(SpotifyFeature.pauseSong(spotifyService, user).build()).queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java index bacece1..fb63ade 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/ResumeSubCommand.java @@ -27,7 +27,7 @@ public class ResumeSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - interaction.replyEmbeds(SpotifyFeature.resumeSong(spotifyService, user).build()).queue(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + event.replyEmbeds(SpotifyFeature.resumeSong(spotifyService, user).build()).queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java index 9443caa..c7ae5a6 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/SkipSubCommand.java @@ -30,7 +30,7 @@ public class SkipSubCommand extends BatSubCommand { } @Override - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { - interaction.replyEmbeds(SpotifyFeature.skipSong(spotifyService, user).build()).queue(); + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { + event.replyEmbeds(SpotifyFeature.skipSong(spotifyService, user).build()).queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/spotify/command/UnlinkSubCommand.java b/src/main/java/cc/fascinated/bat/features/spotify/command/UnlinkSubCommand.java index cfd99ae..0e66498 100644 --- a/src/main/java/cc/fascinated/bat/features/spotify/command/UnlinkSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/spotify/command/UnlinkSubCommand.java @@ -23,14 +23,14 @@ import org.springframework.stereotype.Component; @CommandInfo(name = "unlink", description = "Unlink your Spotify account") public class UnlinkSubCommand extends BatSubCommand implements EventListener { @Override @SneakyThrows - public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { SpotifyProfile profile = user.getProfile(SpotifyProfile.class); if (!profile.hasLinkedAccount()) { throw new BatException("%s You do not have a linked Spotify account.".formatted(Emojis.CROSS_MARK_EMOJI)); } profile.reset(); - interaction.replyEmbeds(EmbedUtils.successEmbed() + event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("%s Successfully unlinked your Spotify account.".formatted(Emojis.CHECK_MARK_EMOJI)) .build()) .setEphemeral(true)