java.lang.Object
xyz.dynxsty.dih4jda.interactions.commands.RestrictedCommand
xyz.dynxsty.dih4jda.interactions.commands.application.ApplicationCommand<E,T>
xyz.dynxsty.dih4jda.interactions.commands.application.BaseApplicationCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent,net.dv8tion.jda.api.interactions.commands.build.SlashCommandData>
xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand
All Implemented Interfaces:
ExecutableCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent>

public abstract class SlashCommand extends BaseApplicationCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent,net.dv8tion.jda.api.interactions.commands.build.SlashCommandData>
Represents a single Slash Command.
Since:
v1.5
  • Method Details

    • getSubcommands

      public final SlashCommand.Subcommand[] getSubcommands()
    • addSubcommands

      public final void addSubcommands(SlashCommand.Subcommand... classes)
      Sets all Subcommands that belong to this "base" command.
      Parameters:
      classes - The classes (must extend SlashCommand.Subcommand) which should be registered as subcommands.
    • getSubcommandGroups

      public final SlashCommand.SubcommandGroup[] getSubcommandGroups()
    • addSubcommandGroups

      public final void addSubcommandGroups(@Nonnull SlashCommand.SubcommandGroup... groups)
      Sets all Subcommand Groups that belong to this "base" command.
      Parameters:
      groups - A map of the SubcommandGroupData and their corresponding SlashCommand.Subcommands.
    • execute

      public void execute(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event)
      Description copied from interface: ExecutableCommand
      The method that gets called once the command gets executed.
      Parameters:
      event - the command that is getting passed.
    • asCommand

      @Nullable public net.dv8tion.jda.api.interactions.commands.Command asCommand()
      Gets the corresponding JDA entity for this command. If the command was not cached or queued before (e.g. when using sharding), this may return null.
      Returns:
      The Command corresponding to this class.