Added Command abstraction layer

This commit is contained in:
tueem 2024-10-13 14:27:49 +02:00
parent 55bfeee2d0
commit 14f9448ba4
Signed by: tueem
GPG Key ID: 65C8667EC17A88FB
4 changed files with 65 additions and 1 deletions

@ -1,5 +1,28 @@
package net.tomatentum.marinara.command;
public class DiscordCommand {
import net.tomatentum.marinara.handler.InteractionHandler;
public abstract class DiscordCommand implements InteractionHandler {
private String name;
private String description;
private String[] aliases;
protected DiscordCommand(String name, String description, String... aliases) {
this.name = name;
this.description = description;
this.aliases = aliases;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String[] getAliases() {
return aliases;
}
}

@ -0,0 +1,17 @@
package net.tomatentum.marinara.command;
public class GlobalDiscordCommand extends DiscordCommand{
private boolean enabledInDms = false;
public GlobalDiscordCommand(String name, String description, String... aliases) {
super(name, description, aliases);
}
public boolean isEnabledInDms() {
return enabledInDms;
}
public void setEnabledInDms(boolean enabledInDms) {
this.enabledInDms = enabledInDms;
}
}

@ -0,0 +1,13 @@
package net.tomatentum.marinara.command;
public class ServerDiscordCommand extends DiscordCommand {
private long[] servers;
public ServerDiscordCommand(String name, String description, String... aliases) {
super(name, description, aliases);
}
public long[] getServers() {
return servers;
}
}

@ -0,0 +1,11 @@
package net.tomatentum.marinara.command.annotation;
import net.tomatentum.marinara.command.option.OptionType;
public @interface CommandOption {
public String name();
public String description() default "";
public OptionType type() default OptionType.STRING;
public boolean required() default false;
}