diff --git a/pom.xml b/pom.xml
index 8817203..40d1672 100644
--- a/pom.xml
+++ b/pom.xml
@@ -191,5 +191,10 @@
mcutils-java-library
1.2.4
+
+ com.github.Steppschuh
+ Java-Markdown-Generator
+ 1.3.2
+
diff --git a/src/main/java/cc/fascinated/bat/command/BatCommand.java b/src/main/java/cc/fascinated/bat/command/BatCommand.java
index ecdb4e0..3ecd2b7 100644
--- a/src/main/java/cc/fascinated/bat/command/BatCommand.java
+++ b/src/main/java/cc/fascinated/bat/command/BatCommand.java
@@ -4,21 +4,20 @@ import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.*;
+import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.IntegrationType;
import net.dv8tion.jda.api.interactions.InteractionContextType;
-import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
+import net.dv8tion.jda.api.requests.restaction.MessageCreateAction;
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
/**
* @author Braydon
@@ -80,13 +79,16 @@ public abstract class BatCommand {
/**
* Fired when this command is executed.
*
- * @param guild the guild the command was executed in, if any
- * @param user the user who executed the command
- * @param channel the channel the command was executed in
- * @param member the member who executed the command, null if not a guild
- * @param event the event that invoked this command
+ * @param guild the guild the command was executed in, if any
+ * @param user the user who executed the command
+ * @param channel the channel the command was executed in
+ * @param member the member who executed the command, null if not a guild
+ * @param commandMessage the message that invoked this command, if any
+ * @param arguments the arguments of the command, if any
+ * @param event the event that invoked this command, if any
*/
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member,
+ Message commandMessage, String[] arguments, SlashCommandInteraction event) {
}
/**
@@ -145,25 +147,51 @@ public abstract class BatCommand {
}
/**
- * Get an argument from the command.
+ * Reply to the message or interaction with the given contents.
*
- * @param argumentIndex the index of the argument in the command
- * @param option the option to get from the slash command
- * @param arguments the arguments of the invoked command
- * @param event the event that invoked the command
+ * @param message the message to reply to, null if interaction
+ * @param interaction the interaction to reply to, null if message
+ * @param contents the contents to reply with
+ */
+ public void replyMessage(Message message, SlashCommandInteraction interaction, String contents) {
+ if (message != null) {
+ message.reply(contents).queue();
+ } else {
+ interaction.reply(contents).queue();
+ }
+ }
+
+ /**
+ * Reply to the message or interaction with the given embed.
+ *
+ * @param message the message to reply to, null if interaction
+ * @param interaction the interaction to reply to, null if message
+ * @param builder the embed builder to reply with
+ */
+ public void replyEmbed(Message message, SlashCommandInteraction interaction, EmbedBuilder builder) {
+ if (message != null) {
+ message.replyEmbeds(builder.build()).queue();
+ } else {
+ interaction.replyEmbeds(builder.build()).queue();
+ }
+ }
+
+ /**
+ * Get the argument from the command.
+ *
+ * @param option the option to get from the slash command
+ * @param arguments the arguments of the invoked command
+ * @param argumentIndex the index of the argument in the command
+ * @param concatenateLeftover whether to concatenate the leftover arguments
+ * @param event the event that invoked the command
* @return the argument
*/
- public Argument getArgument(int argumentIndex, String option, String[] arguments, SlashCommandInteraction event) {
- return new Argument(argumentIndex, option, arguments, event);
+ public Argument getArgument(String option, String[] arguments, int argumentIndex, boolean concatenateLeftover, SlashCommandInteraction event) {
+ return new Argument(option, arguments, argumentIndex, concatenateLeftover, event);
}
@AllArgsConstructor
public static class Argument {
- /**
- * The index of the argument in the command.
- */
- private final int argumentIndex;
-
/**
* The option to get from the slash command.
*/
@@ -174,6 +202,16 @@ public abstract class BatCommand {
*/
private final String[] arguments;
+ /**
+ * The index of the argument in the command.
+ */
+ private final int argumentIndex;
+
+ /**
+ * Whether to concatenate the leftover arguments.
+ */
+ private final boolean concatenateLeftover;
+
/**
* The event that invoked the command.
*/
@@ -185,14 +223,24 @@ public abstract class BatCommand {
* @return the argument
*/
public String getAsString() {
- if (event != null) {
+ if (event != null) { // Get the option from the event
OptionMapping option = event.getOption(this.option);
if (option == null) {
return null;
}
return option.getAsString();
}
- return arguments[argumentIndex];
+ if (arguments.length < argumentIndex) { // Check if the argument index is out of bounds
+ return null;
+ }
+ if (concatenateLeftover) { // Concatenate the leftover arguments
+ StringBuilder builder = new StringBuilder();
+ for (int i = argumentIndex; i < arguments.length; i++) {
+ builder.append(arguments[i]).append(" ");
+ }
+ return builder.toString().trim();
+ }
+ return arguments[argumentIndex]; // Get the argument at the index
}
}
}
\ No newline at end of file
diff --git a/src/main/java/cc/fascinated/bat/command/CommandInfo.java b/src/main/java/cc/fascinated/bat/command/CommandInfo.java
index 69cfcea..ebecf3e 100644
--- a/src/main/java/cc/fascinated/bat/command/CommandInfo.java
+++ b/src/main/java/cc/fascinated/bat/command/CommandInfo.java
@@ -44,6 +44,13 @@ public @interface CommandInfo {
*/
boolean userInstall() default false;
+ /**
+ * If the command can be executed with a prefix
+ *
+ * @return if the command can be executed with a prefix
+ */
+ boolean prefixAllowed() default false;
+
/**
* The required permissions for the command
*
diff --git a/src/main/java/cc/fascinated/bat/command/InternalCommandInfo.java b/src/main/java/cc/fascinated/bat/command/InternalCommandInfo.java
index 22cffc7..3c463a3 100644
--- a/src/main/java/cc/fascinated/bat/command/InternalCommandInfo.java
+++ b/src/main/java/cc/fascinated/bat/command/InternalCommandInfo.java
@@ -48,6 +48,11 @@ public class InternalCommandInfo {
*/
private boolean botOwnerOnly;
+ /**
+ * Whether the command can be ran with a prefix.
+ */
+ private boolean prefixAllowed;
+
protected InternalCommandInfo(@NonNull CommandInfo annotation) {
name = annotation.name();
description = annotation.description();
@@ -56,5 +61,6 @@ public class InternalCommandInfo {
guildOnly = annotation.guildOnly() && !annotation.userInstall();
userInstall = annotation.userInstall();
botOwnerOnly = annotation.botOwnerOnly();
+ prefixAllowed = annotation.prefixAllowed();
}
}
\ No newline at end of file
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 3dd30a4..5b743fb 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -29,14 +30,16 @@ public class AfkCommand extends BatCommand {
/**
* Fired when this command is executed.
*
- * @param guild the guild the command was executed in, if any
- * @param user the user who executed the command
- * @param channel the channel the command was executed in
- * @param member the member who executed the command, null if not a guild
- * @param event the event that invoked this command
+ * @param guild the guild the command was executed in, if any
+ * @param user the user who executed the command
+ * @param channel the channel the command was executed in
+ * @param member the member who executed the command, null if not a guild
+ * @param commandMessage
+ * @param arguments
+ * @param event the event that invoked this command
*/
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
AfkProfile profile = guild.getProfile(AfkProfile.class);
String reason = null;
OptionMapping reasonOption = event.getOption("reason");
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 708b014..9246daa 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -30,7 +31,7 @@ public class AddSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
// Check if the guild has reached the maximum auto roles count
int maxRoleSlots = AutoRoleProfile.getMaxRoleSlots(guild);
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 1a66939..f4997d7 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,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "clear", description = "Clears all auto roles")
public class ClearSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
profile.reset();
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 599a213..7eed23f 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "list", description = "Lists all auto roles")
public class ListSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
if (profile.getRoles().isEmpty()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 e0d1b0a..54d1903 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -29,7 +30,7 @@ public class RemoveSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
OptionMapping option = event.getOption("role");
assert option != null;
diff --git a/src/main/java/cc/fascinated/bat/features/autorole/command/SyncSubCommand.java b/src/main/java/cc/fascinated/bat/features/autorole/command/SyncSubCommand.java
index c7736d5..7e7744c 100644
--- a/src/main/java/cc/fascinated/bat/features/autorole/command/SyncSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/autorole/command/SyncSubCommand.java
@@ -11,6 +11,7 @@ import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
@@ -29,7 +30,7 @@ import java.util.Map;
@CommandInfo(name = "sync", description = "Gives everyone their missing auto roles")
public class SyncSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
if (profile.getRoles().isEmpty()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumRemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumRemoveSubCommand.java
index d5befda..d82bcf0 100644
--- a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumRemoveSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumRemoveSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.premium.PremiumProfile;
import cc.fascinated.bat.service.GuildService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -31,7 +32,7 @@ public class PremiumRemoveSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping guildOption = event.getOption("guild");
if (guildOption == null) {
event.reply("Please provide a guild id").queue();
diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumSetSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumSetSubCommand.java
index c901282..4b53f7d 100644
--- a/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumSetSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumSetSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.premium.PremiumProfile;
import cc.fascinated.bat.service.GuildService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -34,7 +35,7 @@ public class PremiumSetSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping guildOption = event.getOption("guild");
if (guildOption == null) {
event.reply("Please provide a guild id").queue();
diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/EightBallCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/EightBallCommand.java
index 19338c9..de49716 100644
--- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/EightBallCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/EightBallCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
@@ -18,7 +19,13 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7)
*/
@Component
-@CommandInfo(name = "8ball", description = "Ask the magic 8ball a question", guildOnly = false, userInstall = true, category = Category.FUN)
+@CommandInfo(
+ name = "8ball", description = "Ask the magic 8ball a question",
+ guildOnly = false,
+ userInstall = true,
+ prefixAllowed = true,
+ category = Category.FUN
+)
public class EightBallCommand extends BatCommand {
private final String[] responses = new String[]{
"It is certain",
@@ -48,17 +55,18 @@ public class EightBallCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
- String question = super.getArgument(0, "question", null, event).getAsString();
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
+ String question = super.getArgument("question", arguments, 0, true, event).getAsString();
if (question == null) {
- // todo: reply
+ super.replyEmbed(commandMessage, event, EmbedUtils.errorEmbed()
+ .setDescription("You need to provide a question to ask the 8ball")
+ );
return;
}
String response = responses[(int) (Math.random() * responses.length)];
- event.replyEmbeds(EmbedUtils.successEmbed()
- .setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
- .build())
- .queue();
+ super.replyEmbed(commandMessage, event, EmbedUtils.successEmbed()
+ .setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
+ );
}
}
diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java
index 3f60a15..3f53782 100644
--- a/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/base/commands/fun/PPSizeCommand.java
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -34,7 +35,7 @@ public class PPSizeCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
assert userOption != null; // This should never be null
User target = userOption.getAsUser();
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 35ff9eb..c42fc90 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.model.token.thecatapi.CatImageToken;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "cat", description = "Get a random cat image")
public class CatSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
CatImageToken[] responseEntity = WebRequest.getAsEntity("https://api.thecatapi.com/v1/images/search", CatImageToken[].class);
if (responseEntity == null || responseEntity.length == 0) {
event.reply("Failed to get a cat image!").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 754a36c..baf08ab 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.model.token.dogceo.RandomImage;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "dog", description = "Get a random dog image")
public class DogSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
RandomImage responseEntity = WebRequest.getAsEntity("https://dog.ceo/api/breeds/image/random", RandomImage.class);
if (responseEntity == null) {
event.reply("Failed to get a dog image!").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 788af42..bb69948 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.model.token.randomd.RandomDuck;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "duck", description = "Get a random duck image")
public class DuckSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
RandomDuck responseEntity = WebRequest.getAsEntity("https://random-d.uk/api/v2/random", RandomDuck.class);
if (responseEntity == null) {
event.reply("Failed to get a duck image!").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 a6c9a7d..acbc954 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.model.token.randomfox.RandomFoxToken;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "fox", description = "Get a random fox image")
public class FoxSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
RandomFoxToken responseEntity = WebRequest.getAsEntity("https://randomfox.ca/floof/", RandomFoxToken.class);
if (responseEntity == null) {
event.reply("Failed to get a fox image!").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 8767b68..5347cc6 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
@@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,7 +39,7 @@ public class BotStatsCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
JDA jda = DiscordService.JDA;
long memoryUsed = (runtime.totalMemory() - runtime.freeMemory());
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 f3f1854..bcf847e 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
@@ -14,13 +14,13 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.CommandService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.Arrays;
import java.util.List;
/**
@@ -42,7 +42,7 @@ public class HelpCommand extends BatCommand implements EventListener {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
InteractionBuilder interactionBuilder = new InteractionBuilder();
interactionBuilder.addUrlButton("Invite Me", Consts.INVITE_URL, null);
interactionBuilder.addUrlButton("Support Server", Consts.SUPPORT_INVITE_URL, null);
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 3964c59..c4ab1a7 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false, category = Category.GENERAL)
public class InviteCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
event.replyEmbeds(EmbedUtils.genericEmbed()
.setDescription("You can invite the bot to your server by clicking [here](%s)".formatted(Consts.INVITE_URL))
.build())
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 daac3e3..2787a43 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.DiscordService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -16,10 +17,16 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7)
*/
@Component
-@CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false, userInstall = true, category = Category.GENERAL)
+@CommandInfo(
+ name = "ping",
+ description = "Gets the ping of the bot",
+ guildOnly = false,
+ userInstall = true,
+ category = Category.GENERAL
+)
public class PingCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
long time = System.currentTimeMillis();
event.reply("Pinging...").queue(response -> {
response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted(
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 13132b4..732bf48 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -25,7 +26,7 @@ public class VoteCommand extends BatCommand {
};
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
DescriptionBuilder description = new DescriptionBuilder("Vote Links");
description.appendLine("Vote for the bot on the following websites to support us!", false);
for (String link : VOTE_LINKS) {
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 ec8dc71..cfc9fb6 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import net.dv8tion.jda.api.utils.ImageProxy;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "guild", description = "View the avatar of the guild", category = Category.GENERAL)
public class GuildSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
ImageProxy icon = guild.getDiscordGuild().getIcon();
if (icon == null) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 40b9753..a256bad 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -27,7 +28,7 @@ public class UserSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
assert userOption != null;
User target = userOption.getAsUser();
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 ff661d0..1d9046e 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import net.dv8tion.jda.api.utils.ImageProxy;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "guild", description = "View the banner of the guild", category = Category.GENERAL)
public class GuildSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
ImageProxy banner = guild.getDiscordGuild().getBanner();
if (banner == null) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 641d49d..4801f4a 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -28,7 +29,7 @@ public class UserSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
assert userOption != null;
User target = userOption.getAsUser();
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 284e656..2a574c4 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@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 event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
Guild discordGuild = guild.getDiscordGuild();
int totalMembers = 0, totalUsers = 0, totalBots = 0;
for (Member guildMember : discordGuild.getMembers()) {
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 ff257e5..f636e4d 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
@@ -10,6 +10,7 @@ import lombok.NonNull;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -21,7 +22,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 event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
PremiumProfile premium = guild.getPremiumProfile();
EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information");
if (premium.hasPremium()) {
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 6e4ebb1..8e4d2b2 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.Channel;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -27,7 +28,7 @@ public class RemoveTopicSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
if (!(target instanceof TextChannel textChannel)) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 f3e26d4..f1f30ac 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.Channel;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -32,7 +33,7 @@ public class SetTopicSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
Channel target = event.getOption("channel") == null ? channel : Objects.requireNonNull(event.getOption("channel")).getAsChannel();
if (!(target instanceof TextChannel textChannel)) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 482359e..36deef3 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
@@ -7,6 +7,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.Channel;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -26,7 +27,7 @@ public class ViewTopicSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
if (!(target instanceof TextChannel textChannel)) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 d743419..c7cb76e 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.FeatureService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -30,7 +31,7 @@ public class DisableSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
FeatureProfile featureProfile = guild.getFeatureProfile();
OptionMapping featureOption = event.getOption("feature");
if (featureOption == null) {
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 3da2f17..1a1ffd6 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.FeatureService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -30,7 +31,7 @@ public class EnableSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
FeatureProfile featureProfile = guild.getFeatureProfile();
OptionMapping featureOption = event.getOption("feature");
if (featureOption == null) {
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 0c27723..bd2aaa3 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.FeatureService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -21,7 +22,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "list", description = "Lists the features and their states")
public class ListSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
StringBuilder featureStates = new StringBuilder();
for (Feature feature : FeatureService.INSTANCE.getFeaturesSorted()) {
FeatureProfile featureProfile = guild.getFeatureProfile();
diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java
index 6718b20..cd192b1 100644
--- a/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/base/commands/utility/PastebinCommand.java
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -35,7 +36,7 @@ public class PastebinCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping textOption = event.getOption("text");
assert textOption != null;
String text = textOption.getAsString();
diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/utility/lookup/UserSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/utility/lookup/UserSubCommand.java
index 64224a6..b1c8577 100644
--- a/src/main/java/cc/fascinated/bat/features/base/commands/utility/lookup/UserSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/base/commands/utility/lookup/UserSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -33,7 +34,7 @@ public class UserSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping idOption = event.getOption("id");
if (idOption == null) {
return;
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 92b6a46..23a919e 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
@@ -32,7 +33,7 @@ public class ChannelSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile();
OptionMapping option = event.getOption("channel");
if (option == null) {
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 051456b..bd62712 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -30,7 +31,7 @@ public class MessageSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile();
OptionMapping messageOption = event.getOption("message");
assert messageOption != null;
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 ae27de4..2697c19 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -30,7 +31,7 @@ public class PrivateSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile();
OptionMapping enabledOption = event.getOption("enabled");
assert enabledOption != null;
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 8fe26d3..6d39033 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "remove", description = "Remove your birthday from this guild")
public class RemoveSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile();
profile.removeBirthday(user.getId());
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 6cd3ce0..66b0029 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -36,7 +37,7 @@ public class SetSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile();
if (!profile.hasChannelSetup()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 5c09ad9..c11976e 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -34,7 +35,7 @@ public class ViewSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
BirthdayProfile profile = guild.getBirthdayProfile();
if (!profile.hasChannelSetup()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/counter/command/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/counter/command/RemoveSubCommand.java
index 7b21beb..e103002 100644
--- a/src/main/java/cc/fascinated/bat/features/counter/command/RemoveSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/counter/command/RemoveSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -32,7 +33,7 @@ public class RemoveSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping channelOption = event.getOption("channel");
assert channelOption != null;
GuildChannelUnion targetChannel = channelOption.getAsChannel();
diff --git a/src/main/java/cc/fascinated/bat/features/counter/command/SetBreakingSubCommand.java b/src/main/java/cc/fascinated/bat/features/counter/command/SetBreakingSubCommand.java
index d4aa1e7..110eaf4 100644
--- a/src/main/java/cc/fascinated/bat/features/counter/command/SetBreakingSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/counter/command/SetBreakingSubCommand.java
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -32,7 +33,7 @@ public class SetBreakingSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping channelOption = event.getOption("channel");
assert channelOption != null;
OptionMapping breakableOption = event.getOption("breakable");
diff --git a/src/main/java/cc/fascinated/bat/features/counter/command/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/counter/command/SetSubCommand.java
index 637ef09..8845381 100644
--- a/src/main/java/cc/fascinated/bat/features/counter/command/SetSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/counter/command/SetSubCommand.java
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -32,7 +33,7 @@ public class SetSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping channelOption = event.getOption("channel");
assert channelOption != null;
OptionMapping countOption = event.getOption("count");
diff --git a/src/main/java/cc/fascinated/bat/features/counter/command/SetupSubCommand.java b/src/main/java/cc/fascinated/bat/features/counter/command/SetupSubCommand.java
index ee64ac0..0a8c58f 100644
--- a/src/main/java/cc/fascinated/bat/features/counter/command/SetupSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/counter/command/SetupSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -31,7 +32,7 @@ public class SetupSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping channelOption = event.getOption("channel");
assert channelOption != null;
OptionMapping breakableOption = event.getOption("breakable");
diff --git a/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java b/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java
index 40be297..a15f691 100644
--- a/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.GuildVoiceState;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -64,7 +65,7 @@ public class RequestSubCommand extends BatCommand implements EventListener {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
GuildVoiceState voiceState = member.getVoiceState();
// Check if the user is in a voice channel
if (voiceState == null || voiceState.getChannel() == null) {
diff --git a/src/main/java/cc/fascinated/bat/features/leveling/command/ChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/leveling/command/ChannelSubCommand.java
index 98bde4b..dbf35be 100644
--- a/src/main/java/cc/fascinated/bat/features/leveling/command/ChannelSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/leveling/command/ChannelSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
@@ -35,7 +36,7 @@ public class ChannelSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping channelOption = event.getOption("channel");
assert channelOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/leveling/command/CurrentSubCommand.java b/src/main/java/cc/fascinated/bat/features/leveling/command/CurrentSubCommand.java
index 6a52a48..94e7957 100644
--- a/src/main/java/cc/fascinated/bat/features/leveling/command/CurrentSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/leveling/command/CurrentSubCommand.java
@@ -13,6 +13,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -41,7 +42,7 @@ public class CurrentSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
LevelingProfile profile = guild.getLevelingProfile();
diff --git a/src/main/java/cc/fascinated/bat/features/leveling/command/ResetSubCommand.java b/src/main/java/cc/fascinated/bat/features/leveling/command/ResetSubCommand.java
index 33d2699..beca302 100644
--- a/src/main/java/cc/fascinated/bat/features/leveling/command/ResetSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/leveling/command/ResetSubCommand.java
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -35,7 +36,7 @@ public class ResetSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
assert userOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java
index 45bdd66..d189e86 100644
--- a/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java
@@ -6,7 +6,6 @@ import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.InteractionBuilder;
-import cc.fascinated.bat.common.StringUtils;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.logging.LogCategory;
import cc.fascinated.bat.features.logging.LogProfile;
@@ -15,18 +14,13 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
-import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
-import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
-import net.dv8tion.jda.api.interactions.components.ActionRow;
-import net.dv8tion.jda.api.interactions.components.selections.SelectOption;
-import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu;
import org.springframework.stereotype.Component;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -36,7 +30,7 @@ import java.util.List;
@CommandInfo(name = "list", description = "See all the log types and their channels")
public class ListSubCommand extends BatCommand implements EventListener {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
LogProfile profile = guild.getLogProfile();
InteractionBuilder interactionBuilder = new InteractionBuilder();
diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java
index 1705cce..09529ce 100644
--- a/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -32,7 +33,7 @@ public class RemoveSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping typeOption = event.getOption("type");
assert typeOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java
index c87d66f..ec58794 100644
--- a/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -36,7 +37,7 @@ public class SetSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping typeOption = event.getOption("type");
assert typeOption != null;
OptionMapping channelOption = event.getOption("channel");
diff --git a/src/main/java/cc/fascinated/bat/features/messagesnipe/command/ClearSubCommand.java b/src/main/java/cc/fascinated/bat/features/messagesnipe/command/ClearSubCommand.java
index 55e370c..7fb6235 100644
--- a/src/main/java/cc/fascinated/bat/features/messagesnipe/command/ClearSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/messagesnipe/command/ClearSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "clear", description = "Clears the known sniped messages for this guild", requiredPermissions = Permission.MESSAGE_MANAGE)
public class ClearSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
boolean cleared = MessageSnipeFeature.clearSnipedMessages(guild);
if (!cleared) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/messagesnipe/command/DeletedSubCommand.java b/src/main/java/cc/fascinated/bat/features/messagesnipe/command/DeletedSubCommand.java
index e38e2ba..0ea8813 100644
--- a/src/main/java/cc/fascinated/bat/features/messagesnipe/command/DeletedSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/messagesnipe/command/DeletedSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
@@ -23,7 +24,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "deleted", description = "Snipe the last deleted message in this channel")
public class DeletedSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
SnipedMessage message = MessageSnipeFeature.getDeletedMessage(guild, channel.getId());
if (message == null) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupPlayerSubCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupPlayerSubCommand.java
index 4833d36..4b25c78 100644
--- a/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupPlayerSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupPlayerSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -34,7 +35,7 @@ public class LookupPlayerSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping playerOption = event.getOption("player");
assert playerOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupServerSubCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupServerSubCommand.java
index 43fc9b7..eb7c8be 100644
--- a/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupServerSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/minecraft/LookupServerSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -38,7 +39,7 @@ public class LookupServerSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping platformOption = event.getOption("platform");
assert platformOption != null;
OptionMapping hostOption = event.getOption("host");
diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/AddSubCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/AddSubCommand.java
index 156fc50..7f952c1 100644
--- a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/AddSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/AddSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
@@ -41,7 +42,7 @@ public class AddSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping platformOption = event.getOption("platform");
assert platformOption != null;
OptionMapping hostOption = event.getOption("host");
diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ListSubCommand.java
index 95de921..60dd541 100644
--- a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ListSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/ListSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -31,7 +32,7 @@ import java.util.Map;
)
public class ListSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
MinecraftProfile profile = guild.getMinecraftProfile();
Map> watchers = new HashMap<>();
diff --git a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/RemoveSubCommand.java
index 315b441..314a2a3 100644
--- a/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/RemoveSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/minecraft/command/serverwatcher/RemoveSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -36,7 +37,7 @@ public class RemoveSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping platformOption = event.getOption("platform");
assert platformOption != null;
OptionMapping hostOption = event.getOption("host");
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/BanCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/BanCommand.java
index c7b2349..1bd8bdd 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/BanCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/BanCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -43,7 +44,7 @@ public class BanCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping memberOption = event.getOption("member");
OptionMapping reasonOption = event.getOption("reason");
OptionMapping lengthOption = event.getOption("length");
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/KickCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/KickCommand.java
index aa2de93..069b0ee 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/KickCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/KickCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -41,7 +42,7 @@ public class KickCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
assert event.getGuild() != null;
OptionMapping memberOption = event.getOption("member");
OptionMapping reasonOption = event.getOption("reason");
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/MuteCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/MuteCommand.java
index 77667f1..ee68755 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/MuteCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/MuteCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -43,7 +44,7 @@ public class MuteCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping memberOption = event.getOption("member");
OptionMapping reasonOption = event.getOption("reason");
OptionMapping lengthOption = event.getOption("length");
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/PunishHistoryCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/PunishHistoryCommand.java
index b865bb0..c9397de 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/PunishHistoryCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/PunishHistoryCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -44,7 +45,7 @@ public class PunishHistoryCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping memberOption = event.getOption("member");
assert memberOption != null;
BatUser targetUser = userService.getUser(memberOption.getAsUser().getId());
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/PurgeCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/PurgeCommand.java
index abee964..20a44a1 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/PurgeCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/PurgeCommand.java
@@ -42,7 +42,7 @@ public class PurgeCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping amountOption = event.getOption("amount");
assert amountOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/UnbanCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/UnbanCommand.java
index cdfe274..1c9f3df 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/UnbanCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/UnbanCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -42,7 +43,7 @@ public class UnbanCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping memberOption = event.getOption("member");
OptionMapping reasonOption = event.getOption("reason");
assert memberOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/UnmuteCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/UnmuteCommand.java
index a228f8a..aeec612 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/UnmuteCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/UnmuteCommand.java
@@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -42,7 +43,7 @@ public class UnmuteCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping memberOption = event.getOption("member");
OptionMapping reasonOption = event.getOption("reason");
assert memberOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/moderation/command/WarnCommand.java b/src/main/java/cc/fascinated/bat/features/moderation/command/WarnCommand.java
index f97521c..be5f718 100644
--- a/src/main/java/cc/fascinated/bat/features/moderation/command/WarnCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/moderation/command/WarnCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -41,7 +42,7 @@ public class WarnCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping memberOption = event.getOption("member");
OptionMapping reasonOption = event.getOption("reason");
assert memberOption != null;
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 d75a62a..daa3359 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -33,7 +34,7 @@ public class GuildSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
if (target == null) {
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 0b29873..913d835 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -33,7 +34,7 @@ public class UserSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
if (target == null) {
diff --git a/src/main/java/cc/fascinated/bat/features/reminder/command/ClearSubCommand.java b/src/main/java/cc/fascinated/bat/features/reminder/command/ClearSubCommand.java
index e7a4004..0b342cf 100644
--- a/src/main/java/cc/fascinated/bat/features/reminder/command/ClearSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/reminder/command/ClearSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "clear", description = "Clear all your active reminders.")
public class ClearSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
ReminderProfile profile = guild.getReminderProfile();
if (!profile.hasReminders(user.getDiscordUser())) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/reminder/command/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/reminder/command/ListSubCommand.java
index 1794f61..4cf1824 100644
--- a/src/main/java/cc/fascinated/bat/features/reminder/command/ListSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/reminder/command/ListSubCommand.java
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -21,7 +22,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "list", description = "View your active reminders.")
public class ListSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
ReminderProfile profile = guild.getReminderProfile();
if (!profile.hasReminders(user.getDiscordUser())) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/reminder/command/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/reminder/command/SetSubCommand.java
index b2c9cf3..95b2f71 100644
--- a/src/main/java/cc/fascinated/bat/features/reminder/command/SetSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/reminder/command/SetSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -35,7 +36,7 @@ public class SetSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
ReminderProfile profile = guild.getReminderProfile();
if (profile.getReminderCount(user.getDiscordUser()) >= ReminderFeature.MAX_REMINDERS) {
event.replyEmbeds(EmbedUtils.errorEmbed()
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 4023323..abbbdd9 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
@@ -31,7 +32,7 @@ public class ChannelSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
OptionMapping option = event.getOption("channel");
if (option == null) {
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 6bc098e..8602b73 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Resets the settings")
public class ResetSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
profile.reset();
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 8d1400e..f9bbf39 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberAccountToken
import cc.fascinated.bat.service.ScoreSaberService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -32,7 +33,7 @@ public class LinkSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping linkOption = event.getOption("link");
assert linkOption != null;
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 ad61b34..78100e6 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
@@ -7,6 +7,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.ScoreSaberService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +27,7 @@ public class MeSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, 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 8d337e4..843b532 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Reset your settings")
public class ResetSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
ScoreSaberProfile profile = user.getScoreSaberProfile();
profile.reset();
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 615faa2..1aa83d6 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
@@ -26,7 +26,8 @@ public class ScoreSaberCommand extends BatCommand {
context.getBean(LinkSubCommand.class),
context.getBean(UserSubCommand.class),
context.getBean(MeSubCommand.class),
- context.getBean(ResetSubCommand.class)
+ context.getBean(ResetSubCommand.class),
+ context.getBean(ScoresSummarySubCommand.class)
);
}
diff --git a/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoresSummarySubCommand.java b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoresSummarySubCommand.java
new file mode 100644
index 0000000..51dbd06
--- /dev/null
+++ b/src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoresSummarySubCommand.java
@@ -0,0 +1,122 @@
+package cc.fascinated.bat.features.scoresaber.command.scoresaber;
+
+import cc.fascinated.bat.command.BatCommand;
+import cc.fascinated.bat.command.CommandInfo;
+import cc.fascinated.bat.common.EmbedUtils;
+import cc.fascinated.bat.common.NumberFormatter;
+import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
+import cc.fascinated.bat.model.BatGuild;
+import cc.fascinated.bat.model.BatUser;
+import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberLeaderboardToken;
+import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberPlayerScoreToken;
+import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberScoreToken;
+import cc.fascinated.bat.service.ScoreSaberService;
+import lombok.NonNull;
+import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
+import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
+import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
+import net.dv8tion.jda.api.utils.FileUpload;
+import net.steppschuh.markdowngenerator.table.Table;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Fascinated (fascinated7)
+ */
+@Component("scoresaber:scores-summary.sub")
+@CommandInfo(name = "scores-summary", description = "Generate a summary of your scores")
+public class ScoresSummarySubCommand extends BatCommand {
+ private final ScoreSaberService scoreSaberService;
+
+ @Autowired
+ public ScoresSummarySubCommand(@NonNull ScoreSaberService scoreSaberService) {
+ this.scoreSaberService = scoreSaberService;
+ }
+
+ @Override
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
+ ScoreSaberProfile profile = user.getScoreSaberProfile();
+
+ event.replyEmbeds(EmbedUtils.genericEmbed()
+ .setDescription("Loading profile for %s...".formatted(user.getDiscordUser().getAsMention()))
+ .build())
+ .queue(message -> {
+ List pages = scoreSaberService.getScores(profile, (currentPage -> {
+ // Only update every 5 pages, but show the first page
+ if (currentPage.getCurrentPage() % 5 != 0 && currentPage.getCurrentPage() != 1) {
+ return;
+ }
+
+ message.editOriginalEmbeds(EmbedUtils.genericEmbed()
+ .setDescription("Loading profile for %s... (Page %s/%s)".formatted(
+ user.getDiscordUser().getAsMention(),
+ currentPage.getCurrentPage(),
+ currentPage.getTotalPages()
+ ))
+ .build()).queue();
+ }));
+
+ Table.Builder tableBuilder = new Table.Builder()
+ .withAlignments(Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT)
+ .addRow("Song", "PP", "Accuracy", "Rank");
+
+ int totalRankedScores = 0;
+ List scores = new ArrayList<>();
+ for (ScoreSaberService.CachedPage page : pages) {
+ Collections.addAll(scores, page.getPage().getPlayerScores());
+ }
+
+ // Sort by highest PP first
+ scores.sort((score1, score2) -> {
+ if (score1.getScore().getPp() > score2.getScore().getPp()) {
+ return -1;
+ } else if (score1.getScore().getPp() < score2.getScore().getPp()) {
+ return 1;
+ }
+ return 0;
+ });
+
+ // Add the scores to the table
+ for (ScoreSaberPlayerScoreToken scoreToken : scores) {
+ ScoreSaberScoreToken score = scoreToken.getScore();
+ ScoreSaberLeaderboardToken leaderboard = scoreToken.getLeaderboard();
+ double acc = leaderboard.getMaxScore() == 0 ? 0 : ((double) score.getBaseScore() / leaderboard.getMaxScore()) * 100;
+
+ tableBuilder.addRow(
+ "[%s](https://scoresaber.com/leaderboard/%s)".formatted(
+ leaderboard.getSongName(),
+ leaderboard.getId()
+ ),
+ NumberFormatter.simpleFormat(score.getPp()) + "pp",
+ NumberFormatter.simpleFormat(acc) + "%",
+ "#" + NumberFormatter.simpleFormat(score.getRank())
+ );
+
+ if (score.getPp() != 0) {
+ totalRankedScores++;
+ }
+ }
+
+ message.editOriginalEmbeds(EmbedUtils.genericEmbed()
+ .setDescription("""
+ **Scores Summary**
+ Here is a summary of score for %s
+ \s
+ Total Scores: %s
+ Total Ranked Scores: %s
+ """.formatted(
+ user.getDiscordUser().getAsMention(),
+ NumberFormatter.simpleFormat(scores.size()),
+ NumberFormatter.simpleFormat(totalRankedScores)
+ ))
+ .build())
+ .queue();
+ channel.sendFiles(FileUpload.fromData(tableBuilder.build().toString().getBytes(), "scores-summary.txt")).queue();
+ });
+ }
+}
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 46fd548..1cc2bd5 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.service.ScoreSaberService;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -34,7 +35,7 @@ public class UserSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping userOption = event.getOption("user");
assert userOption != null;
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 7a86f7e..7be8ce3 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
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
@@ -31,7 +32,7 @@ public class ChannelSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
OptionMapping option = event.getOption("channel");
if (option == null) {
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 fbdf79b..7bff16f 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Resets the settings")
public class ResetSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
profile.reset();
event.replyEmbeds(EmbedUtils.successEmbed()
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 879214a..966e946 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.UserService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -34,7 +35,7 @@ public class UserSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
OptionMapping option = event.getOption("user");
if (option == null) {
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 7802012..7ea2d7a 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
@@ -10,6 +10,7 @@ import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +31,7 @@ public class CurrentSubCommand extends BatCommand implements EventListener {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
event.replyEmbeds(SpotifyFeature.currentSong(spotifyService, user).build()).queue();
}
}
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 ad787b1..3132529 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
@@ -11,6 +11,7 @@ import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull;
import lombok.SneakyThrows;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
@@ -38,7 +39,7 @@ public class LinkSubCommand extends BatCommand implements EventListener {
}
@Override @SneakyThrows
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
// if (!user.getId().equals(Consts.BOT_OWNER)) {
// event.replyEmbeds(EmbedUtils.errorEmbed()
// .setDescription("""
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 68e9e1b..0674912 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +28,7 @@ public class PauseSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, 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 14c29e7..b4a6b19 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +28,7 @@ public class ResumeSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, 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 4c47add..e21f6ef 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
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.slf4j.Logger;
@@ -30,7 +31,7 @@ public class SkipSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, 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 d26637b..e3eeaae 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
@@ -13,6 +13,7 @@ import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull;
import lombok.SneakyThrows;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,7 +33,7 @@ public class UnlinkSubCommand extends BatCommand implements EventListener {
}
@Override @SneakyThrows
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
SpotifyProfile profile = user.getProfile(SpotifyProfile.class);
if (!profile.hasLinkedAccount() || !spotifyService.hasTrackPlaying(user)) {
event.replyEmbeds(SpotifyFeature.checkSpotify(spotifyService, user).build()).queue();
diff --git a/src/main/java/cc/fascinated/bat/features/statschannel/command/AddSubCommand.java b/src/main/java/cc/fascinated/bat/features/statschannel/command/AddSubCommand.java
index f83a901..74c01c3 100644
--- a/src/main/java/cc/fascinated/bat/features/statschannel/command/AddSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/statschannel/command/AddSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -34,7 +35,7 @@ public class AddSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping displayOption = event.getOption("display");
assert displayOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/statschannel/command/CurrentSubCommand.java b/src/main/java/cc/fascinated/bat/features/statschannel/command/CurrentSubCommand.java
index 3954100..69541ba 100644
--- a/src/main/java/cc/fascinated/bat/features/statschannel/command/CurrentSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/statschannel/command/CurrentSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
@@ -28,7 +29,7 @@ import java.util.Map;
)
public class CurrentSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
StatsChannelProfile profile = guild.getStatsChannelProfile();
DescriptionBuilder builder = new DescriptionBuilder("Stats Channels");
if (profile.getChannels().isEmpty()) {
diff --git a/src/main/java/cc/fascinated/bat/features/statschannel/command/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/statschannel/command/RemoveSubCommand.java
index 071ef7b..e682a61 100644
--- a/src/main/java/cc/fascinated/bat/features/statschannel/command/RemoveSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/statschannel/command/RemoveSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
@@ -33,7 +34,7 @@ public class RemoveSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
OptionMapping channelOption = event.getOption("channel");
assert channelOption != null;
diff --git a/src/main/java/cc/fascinated/bat/features/welcomer/command/ChannelSubCommand.java b/src/main/java/cc/fascinated/bat/features/welcomer/command/ChannelSubCommand.java
index 5c5633b..d292f08 100644
--- a/src/main/java/cc/fascinated/bat/features/welcomer/command/ChannelSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/welcomer/command/ChannelSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
@@ -27,7 +28,7 @@ public class ChannelSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
WelcomerProfile profile = guild.getWelcomerProfile();
OptionMapping channelOption = event.getOption("channel");
if (channelOption == null) {
diff --git a/src/main/java/cc/fascinated/bat/features/welcomer/command/CurrentSubCommand.java b/src/main/java/cc/fascinated/bat/features/welcomer/command/CurrentSubCommand.java
index 95335f5..277ec8c 100644
--- a/src/main/java/cc/fascinated/bat/features/welcomer/command/CurrentSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/welcomer/command/CurrentSubCommand.java
@@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "current", description = "View the current welcomer configuration")
public class CurrentSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
WelcomerProfile profile = guild.getWelcomerProfile();
if (!profile.isEmbed() && !profile.isMessage()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/features/welcomer/command/EmbedSubCommand.java b/src/main/java/cc/fascinated/bat/features/welcomer/command/EmbedSubCommand.java
index 915d9e6..39e800d 100644
--- a/src/main/java/cc/fascinated/bat/features/welcomer/command/EmbedSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/welcomer/command/EmbedSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -34,7 +35,7 @@ public class EmbedSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
WelcomerProfile profile = guild.getWelcomerProfile();
OptionMapping titleOption = event.getOption("title");
OptionMapping descriptionOption = event.getOption("description");
diff --git a/src/main/java/cc/fascinated/bat/features/welcomer/command/MessageSubCommand.java b/src/main/java/cc/fascinated/bat/features/welcomer/command/MessageSubCommand.java
index 2fd8a9f..4852500 100644
--- a/src/main/java/cc/fascinated/bat/features/welcomer/command/MessageSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/welcomer/command/MessageSubCommand.java
@@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -29,7 +30,7 @@ public class MessageSubCommand extends BatCommand {
}
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
WelcomerProfile profile = guild.getWelcomerProfile();
OptionMapping messageOption = event.getOption("message");
if (messageOption == null) {
diff --git a/src/main/java/cc/fascinated/bat/features/welcomer/command/ResetSubCommand.java b/src/main/java/cc/fascinated/bat/features/welcomer/command/ResetSubCommand.java
index 1c99e34..74d0e04 100644
--- a/src/main/java/cc/fascinated/bat/features/welcomer/command/ResetSubCommand.java
+++ b/src/main/java/cc/fascinated/bat/features/welcomer/command/ResetSubCommand.java
@@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.Member;
+import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
import org.springframework.stereotype.Component;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@CommandInfo(name = "reset", description = "Clear the welcomer configuration")
public class ResetSubCommand extends BatCommand {
@Override
- public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
+ public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
WelcomerProfile profile = guild.getWelcomerProfile();
if (!profile.isEmbed() && !profile.isMessage()) {
event.replyEmbeds(EmbedUtils.errorEmbed()
diff --git a/src/main/java/cc/fascinated/bat/model/BatGuild.java b/src/main/java/cc/fascinated/bat/model/BatGuild.java
index 2fc9725..e65a974 100644
--- a/src/main/java/cc/fascinated/bat/model/BatGuild.java
+++ b/src/main/java/cc/fascinated/bat/model/BatGuild.java
@@ -21,6 +21,7 @@ import com.mongodb.client.model.ReplaceOptions;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.entities.Guild;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,8 +36,10 @@ import java.util.Map;
*/
@Getter
@Setter
+@Log4j2
public class BatGuild extends ProfileHolder {
- private static final Logger log = LoggerFactory.getLogger(BatGuild.class);
+ private static final String DEFAULT_PREFIX = "!";
+
/**
* The document that belongs to this guild
*/
@@ -49,6 +52,11 @@ public class BatGuild extends ProfileHolder {
@Id
private final String id;
+ /**
+ * The prefix of the guild
+ */
+ private final String prefix;
+
/**
* The time this guild was joined
*/
@@ -63,6 +71,7 @@ public class BatGuild extends ProfileHolder {
this.id = id;
this.document = document;
boolean newAccount = this.document.isEmpty();
+ this.prefix = newAccount ? DEFAULT_PREFIX : (String) document.getOrDefault("prefix", DEFAULT_PREFIX);
this.createdAt = newAccount ? new Date() : document.getDate("createdAt");
Guild guild = DiscordService.JDA.getGuildById(id);
diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java
index 3c2bb9c..0e8f760 100644
--- a/src/main/java/cc/fascinated/bat/service/CommandService.java
+++ b/src/main/java/cc/fascinated/bat/service/CommandService.java
@@ -16,8 +16,10 @@ import lombok.extern.log4j.Log4j2;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Guild;
+import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
+import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.Command;
import org.jetbrains.annotations.NotNull;
@@ -136,7 +138,7 @@ public class CommandService extends ListenerAdapter {
/**
* Gets commands that are in a specific category
*
- * @param category The category
+ * @param category The category
* @param includeGuildCommands If guild commands should be included
* @return The commands
*/
@@ -184,57 +186,19 @@ public class CommandService extends ListenerAdapter {
BatUser user = userService.getUser(event.getUser().getId());
BatGuild guild = event.getGuild() == null ? null : guildService.getGuild(event.getGuild().getId());
- // Only the bot owner can run this command
- if (command.getInfo().isBotOwnerOnly() && !user.getId().equalsIgnoreCase(Consts.BOT_OWNER)) {
+ String executeChecks = runPreExecuteChecks(command, user, guild, event.getMember());
+ if (executeChecks != null) {
event.replyEmbeds(EmbedUtils.errorEmbed()
- .setDescription("You do not have permission to execute this command")
+ .setDescription(executeChecks)
.build()).setEphemeral(true).queue();
return;
}
- // Check if the command is guild only and if it was not ran inside a guild
- if (command.getInfo().isGuildOnly() && guild == null) {
- event.replyEmbeds(EmbedUtils.errorEmbed()
- .setDescription("This command can only be executed in a guild")
- .build()).setEphemeral(true).queue();
- return;
- }
-
- // Check if the feature is disabled in the guild
- if (guild != null) {
- FeatureProfile featureProfile = guild.getFeatureProfile();
- if (featureProfile.isFeatureDisabled(command.getFeature())) {
- event.replyEmbeds(EmbedUtils.errorEmbed()
- .setDescription("The feature `%s` is disabled in this guild".formatted(command.getFeature().getName()))
- .build()).setEphemeral(true).queue();
- return;
- }
- }
-
- // Check if the user has the required permissions
- if (guild != null && event.getMember() != null) {
- List missingPermissions = new ArrayList<>();
- for (Permission permission : command.getInfo().getPermissions()) {
- if (!event.getMember().hasPermission(permission)) {
- missingPermissions.add(permission);
- }
- }
- if (!missingPermissions.isEmpty()) {
- event.replyEmbeds(EmbedUtils.errorEmbed()
- .setDescription("You are missing the following permissions to execute this command:\n" +
- missingPermissions.stream().map(perm -> "`" + perm.name() + "`").collect(Collectors.joining(", ")))
- .build())
- .setEphemeral(true)
- .queue();
- return;
- }
- }
-
// Execute the command
try {
MessageChannelUnion channel = event.getChannel();
- command.execute(guild, user, channel, event.getMember(), event.getInteraction());
- log.info("Executed command \"{}\" for user \"{}\" in channel \"{}\" (took: {}ms)",
+ command.execute(guild, user, channel, event.getMember(), null, null, event.getInteraction());
+ log.info("Executed slash command \"{}\" for user \"{}\" in channel \"{}\" (took: {}ms)",
command.getInfo().getName(),
user.getName(),
channel.getName(),
@@ -253,4 +217,106 @@ public class CommandService extends ListenerAdapter {
Sentry.captureException(ex, hint); // Capture the exception
}
}
+
+ @Override
+ public void onMessageReceived(@NotNull MessageReceivedEvent event) {
+ if (event.getAuthor().isBot() || !event.isFromGuild()) { // This message wasn't sent in a guild
+ return;
+ }
+ BatUser user = userService.getUser(event.getAuthor().getId());
+ if (user == null) {
+ return;
+ }
+ BatGuild guild = guildService.getGuild(event.getGuild().getId());
+ String message = event.getMessage().getContentRaw();
+ if (!message.startsWith(guild.getPrefix())) { // Check if the message starts with the guild prefix
+ return;
+ }
+
+ String[] parts = message.substring(guild.getPrefix().length()).split("\\s+");
+ String commandName = parts[0].toLowerCase();
+ String[] args = parts.length > 1 ? new String[parts.length - 1] : new String[0];
+ if (args.length > 0) {
+ System.arraycopy(parts, 1, args, 0, args.length);
+ }
+ BatCommand command = commands.get(commandName);
+ if (command == null) {
+ return;
+ }
+ if (!command.getInfo().isPrefixAllowed()) { // Check if the command is allowed to be ran with a prefix
+ return;
+ }
+
+ String executeChecks = runPreExecuteChecks(command, user, guild, event.getMember());
+ if (executeChecks != null) {
+ event.getChannel().sendMessageEmbeds(EmbedUtils.errorEmbed()
+ .setDescription(executeChecks)
+ .build()).queue();
+ return;
+ }
+
+ // Execute the command
+ try {
+ command.execute(guild, user, event.getChannel(), event.getMember(), event.getMessage(), args, null);
+ log.info("Executed prefixed command \"{}{}\" for user \"{}\" in channel \"{}\"",
+ command.getInfo().getName(),
+ args.length > 0 ? " " + String.join(" ", args) : "",
+ user.getName(),
+ event.getChannel().getName()
+ );
+ } catch (Exception ex) {
+ log.error("An error occurred while executing command \"{}\"", command.getInfo().getName(), ex);
+ event.getChannel().sendMessageEmbeds(EmbedUtils.genericInteractionError(ex).build()).queue();
+
+ Hint hint = new Hint();
+ hint.set("command", command.getInfo().getName());
+ hint.set("user", user.getId());
+ hint.set("guild", guild.getId());
+ Sentry.captureException(ex, hint); // Capture the exception
+ }
+ }
+
+ /**
+ * Runs pre execute checks for a command
+ *
+ * @param command The command
+ * @param user The user
+ * @param guild The guild
+ * @param member The member
+ * @return The error message if any
+ */
+ public String runPreExecuteChecks(BatCommand command, BatUser user, BatGuild guild, Member member) {
+ // Only the bot owner can run this command
+ if (command.getInfo().isBotOwnerOnly() && !user.getId().equalsIgnoreCase(Consts.BOT_OWNER)) {
+ return "You do not have permission to execute this command";
+ }
+
+ // Check if the command is guild only and if it was not ran inside a guild
+ if (command.getInfo().isGuildOnly() && guild == null) {
+ return "This command can only be executed in a guild";
+ }
+
+ // Check if the feature is disabled in the guild
+ if (guild != null) {
+ FeatureProfile featureProfile = guild.getFeatureProfile();
+ if (featureProfile.isFeatureDisabled(command.getFeature())) {
+ return "The feature `%s` is disabled in this guild".formatted(command.getFeature().getName());
+ }
+ }
+
+ // Check if the user has the required permissions
+ if (guild != null && member != null) {
+ List missingPermissions = new ArrayList<>();
+ for (Permission permission : command.getInfo().getPermissions()) {
+ if (!member.hasPermission(permission)) {
+ missingPermissions.add(permission);
+ }
+ }
+ if (!missingPermissions.isEmpty()) {
+ return "You are missing the following permissions to execute this command:\n" +
+ missingPermissions.stream().map(perm -> "`" + perm.name() + "`").collect(Collectors.joining(", "));
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file