Class SlashCommand.Subcommand

java.lang.Object
xyz.dynxsty.dih4jda.interactions.commands.CommandRequirements
xyz.dynxsty.dih4jda.interactions.commands.SlashCommand.Subcommand
Enclosing class:
SlashCommand

public abstract static class SlashCommand.Subcommand extends CommandRequirements
Model class which represents a single Subcommand.
See Also:
  • Constructor Details

    • Subcommand

      public Subcommand()
  • Method Details

    • getSubcommandData

      public final net.dv8tion.jda.api.interactions.commands.build.SubcommandData getSubcommandData()
    • setSubcommandData

      public final void setSubcommandData(net.dv8tion.jda.api.interactions.commands.build.SubcommandData subCommandData)
      Sets this subcommands' SubcommandData.
      Parameters:
      subCommandData - The SubcommandData which should be used for this subcommand.
      See Also:
      • SubcommandData
    • execute

      public abstract void execute(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event)
      Method that should be overridden for all Slash Commands that should be executed.
      
       public class PingCommand extends SlashCommand.Subcommand {
      
           public PingCommand() {
               setSubcommandData(Commands.slash("ping", "Ping!"));
           }
      
          @Override
          public void execute(SlashCommandInteractionEvent event) {
       		event.reply("Pong!").queue();
          }
      
       }
       
      Since:
      v1.5