Bat/src/main/java/cc/fascinated/bat/command/BatSubCommand.java

48 lines
1.4 KiB
Java

package cc.fascinated.bat.command;
import lombok.Getter;
import lombok.Setter;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import java.util.List;
/**
* @author Fascinated (fascinated7)
*/
@Getter @Setter
public class BatSubCommand implements BatCommandExecutor {
/**
* The command data for the slash command
*/
private final SubcommandData commandData;
/**
* The required permissions for the command
*/
private final List<Permission> requiredPermissions;
/**
* The commands snowflake from Discord
*/
private long commandSnowflake;
public BatSubCommand(String name, String description, Permission... permissions) {
this.commandData = new SubcommandData(name, description);
this.requiredPermissions = List.of(permissions);
}
/**
* Adds an option to the sub command
*
* @param optionType the type of the option
* @param name the name of the option
* @param description the description of the option
* @param required whether the option is required
*/
public void addOption(OptionType optionType, String name, String description, boolean required) {
this.commandData.addOption(optionType, name, description, required);
}
}