diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java index 3a85463..03d755e 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java @@ -1,14 +1,14 @@ package net.tomatentum.marinara.interaction.commands; -import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; -import net.tomatentum.marinara.interaction.commands.annotation.CommandOption; +import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; +import net.tomatentum.marinara.interaction.commands.annotation.SlashCommandOption; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; public record ExecutableSlashCommandDefinition( - ApplicationCommand applicationCommand, + SlashCommand applicationCommand, SubCommand subCommand, String[] subCommandGroups, - CommandOption[] options) { + SlashCommandOption[] options) { @Override public final boolean equals(Object o) { @@ -30,7 +30,7 @@ public record ExecutableSlashCommandDefinition( } public static class Builder { - private ApplicationCommand applicationCommand; + private SlashCommand applicationCommand; private SubCommand subCommand; private String[] subCommandGroupNames; @@ -45,7 +45,7 @@ public record ExecutableSlashCommandDefinition( return new ExecutableSlashCommandDefinition(applicationCommand, subCommand, subCommandGroupNames, subCommand != null ? subCommand.options() : applicationCommand.options()); } - public void setApplicationCommand(ApplicationCommand applicationCommand) { + public void setApplicationCommand(SlashCommand applicationCommand) { this.applicationCommand = applicationCommand; } @@ -57,7 +57,7 @@ public record ExecutableSlashCommandDefinition( this.subCommandGroupNames = subCommandGroupNames; } - public ApplicationCommand getApplicationCommand() { + public SlashCommand getApplicationCommand() { return applicationCommand; } diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java index 9f8b189..133cf5b 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java @@ -4,15 +4,15 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; +import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; public class SlashCommandDefinition { private List executableDefinitons; - private ApplicationCommand applicationCommand; + private SlashCommand applicationCommand; private int subCommandGroupCount = -1; private boolean isRootCommand = false; - public SlashCommandDefinition(ApplicationCommand applicationCommand) { + public SlashCommandDefinition(SlashCommand applicationCommand) { this.executableDefinitons = new ArrayList<>(); this.applicationCommand = applicationCommand; } @@ -42,7 +42,7 @@ public class SlashCommandDefinition { return this; } - public ApplicationCommand getApplicationCommand() { + public SlashCommand getApplicationCommand() { return applicationCommand; } diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/ApplicationCommand.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SlashCommand.java similarity index 76% rename from lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/ApplicationCommand.java rename to lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SlashCommand.java index d8f91af..7972cb0 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/ApplicationCommand.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SlashCommand.java @@ -7,10 +7,9 @@ import java.lang.annotation.Target; @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) -public @interface ApplicationCommand { +public @interface SlashCommand { public String name(); public String description() default ""; - public String[] aliases() default {}; - public CommandOption[] options() default {}; + public SlashCommandOption[] options() default {}; public long[] serverIds() default {}; } diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SlashCommandOption.java similarity index 67% rename from lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java rename to lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SlashCommandOption.java index b76a9bc..09574d3 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/CommandOption.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SlashCommandOption.java @@ -5,13 +5,13 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import net.tomatentum.marinara.interaction.commands.option.OptionType; +import net.tomatentum.marinara.interaction.commands.option.SlashCommandOptionType; @Target({ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) -public @interface CommandOption { +public @interface SlashCommandOption { public String name(); public String description() default ""; - public OptionType type() default OptionType.STRING; + public SlashCommandOptionType type() default SlashCommandOptionType.STRING; public boolean required() default false; } diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java index 5a2a30d..823adf7 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/annotation/SubCommand.java @@ -10,5 +10,5 @@ import java.lang.annotation.Target; public @interface SubCommand { public String name(); public String description() default ""; - public CommandOption[] options() default {}; + public SlashCommandOption[] options() default {}; } diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/OptionType.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/SlashCommandOptionType.java similarity index 86% rename from lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/OptionType.java rename to lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/SlashCommandOptionType.java index 64d0207..db222c8 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/OptionType.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/option/SlashCommandOptionType.java @@ -1,6 +1,6 @@ package net.tomatentum.marinara.interaction.commands.option; -public enum OptionType { +public enum SlashCommandOptionType { ATTACHMENT, BOOLEAN, CHANNEL, diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/CommandInteractionMethod.java b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/CommandInteractionMethod.java index d0a13a5..7bf7ecf 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/CommandInteractionMethod.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/CommandInteractionMethod.java @@ -5,7 +5,7 @@ import java.lang.reflect.Method; import net.tomatentum.marinara.interaction.InteractionHandler; import net.tomatentum.marinara.interaction.InteractionType; import net.tomatentum.marinara.interaction.commands.ExecutableSlashCommandDefinition; -import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; +import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommandGroup; import net.tomatentum.marinara.util.ReflectionUtil; @@ -43,7 +43,7 @@ public class CommandInteractionMethod extends InteractionMethod { private void parseMethod() { ReflectionUtil.checkValidCommandMethod(method); - ApplicationCommand cmd = ReflectionUtil.getAnnotation(method, ApplicationCommand.class); + SlashCommand cmd = ReflectionUtil.getAnnotation(method, SlashCommand.class); ExecutableSlashCommandDefinition.Builder builder = new ExecutableSlashCommandDefinition.Builder(); builder.setApplicationCommand(cmd); diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java index b6f05cc..7a5a909 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java @@ -8,14 +8,14 @@ import java.util.List; import net.tomatentum.marinara.interaction.InteractionHandler; import net.tomatentum.marinara.interaction.InteractionType; -import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; +import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; import net.tomatentum.marinara.wrapper.LibraryWrapper; public abstract class InteractionMethod { public static InteractionMethod create(Method method, InteractionHandler handler, LibraryWrapper wrapper) { - if (method.isAnnotationPresent(ApplicationCommand.class) || method.isAnnotationPresent(SubCommand.class)) + if (method.isAnnotationPresent(SlashCommand.class) || method.isAnnotationPresent(SubCommand.class)) return new CommandInteractionMethod(method, handler, wrapper); return null; diff --git a/lib/src/main/java/net/tomatentum/marinara/util/ReflectionUtil.java b/lib/src/main/java/net/tomatentum/marinara/util/ReflectionUtil.java index 10365fe..227e768 100644 --- a/lib/src/main/java/net/tomatentum/marinara/util/ReflectionUtil.java +++ b/lib/src/main/java/net/tomatentum/marinara/util/ReflectionUtil.java @@ -3,7 +3,7 @@ package net.tomatentum.marinara.util; import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; +import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; public final class ReflectionUtil { @@ -22,16 +22,16 @@ public final class ReflectionUtil { } public static void checkValidCommandMethod(Method method) { - if (method.isAnnotationPresent(ApplicationCommand.class) && - method.getDeclaringClass().isAnnotationPresent(ApplicationCommand.class)) { + if (method.isAnnotationPresent(SlashCommand.class) && + method.getDeclaringClass().isAnnotationPresent(SlashCommand.class)) { throw new RuntimeException(method.getName() + ": Can't have ApplicationCommand Annotation on Class and Method"); } - if (!isAnnotationPresent(method, ApplicationCommand.class)) + if (!isAnnotationPresent(method, SlashCommand.class)) throw new RuntimeException(method.getName() + ": Missing ApplicationCommand Annotation on either Class or Method"); if (!(method.isAnnotationPresent(SubCommand.class) && - isAnnotationPresent(method, ApplicationCommand.class))) { + isAnnotationPresent(method, SlashCommand.class))) { throw new RuntimeException(method.getName() + ": Missing ApplicationCommand Annotation on either Method or Class"); } } diff --git a/lib/src/main/java/net/tomatentum/marinara/wrapper/LibraryWrapper.java b/lib/src/main/java/net/tomatentum/marinara/wrapper/LibraryWrapper.java index 3e10702..ccbb6c9 100644 --- a/lib/src/main/java/net/tomatentum/marinara/wrapper/LibraryWrapper.java +++ b/lib/src/main/java/net/tomatentum/marinara/wrapper/LibraryWrapper.java @@ -6,7 +6,7 @@ import java.util.function.Consumer; import net.tomatentum.marinara.interaction.commands.SlashCommandDefinition; import net.tomatentum.marinara.interaction.commands.ExecutableSlashCommandDefinition; -import net.tomatentum.marinara.interaction.commands.option.OptionType; +import net.tomatentum.marinara.interaction.commands.option.SlashCommandOptionType; import net.tomatentum.marinara.interaction.InteractionType; public abstract class LibraryWrapper { @@ -31,6 +31,6 @@ public abstract class LibraryWrapper { } public abstract InteractionType getInteractionType(Class clazz); - public abstract Object convertCommandOption(Object context, OptionType type, String optionName); + public abstract Object convertCommandOption(Object context, SlashCommandOptionType type, String optionName); public abstract ExecutableSlashCommandDefinition getCommandDefinition(Object context); } \ No newline at end of file