Record Class SlashCommandDefinition

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.SlashCommandDefinition
Record Components:
classDescription - the ClassDescription of the declaring class of the methodDescription()
methodDescription - the MethodDescription of the method this definition is bound to
permissions - a Collection of permissions for this command
name - the name of the command
scope - the CommandScope of this command
guildOnly - whether this command can only be executed in guilds
nsfw - whether this command is nsfw
enabledPermissions - a possibly-empty Set of Permissions this command will be enabled for
localizationFunction - the LocalizationFunction to use for this command
description - the command description
commandOptions - a SequencedCollection of OptionDataDefinitions
cooldown - the corresponding SlashCommandDefinition.CooldownDefinition
isAutoComplete - whether this command supports auto complete
All Implemented Interfaces:
Definition, Invokable, JDAEntity<net.dv8tion.jda.api.interactions.commands.build.CommandData>, CommandDefinition, InteractionDefinition

public record SlashCommandDefinition(@NotNull ClassDescription classDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String name, @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull Set<net.dv8tion.jda.api.Permission> enabledPermissions, @NotNull net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction localizationFunction, @NotNull String description, @NotNull SequencedCollection<OptionDataDefinition> commandOptions, @NotNull SlashCommandDefinition.CooldownDefinition cooldown, boolean isAutoComplete) extends Record implements CommandDefinition
Representation of a slash command.
  • Constructor Details

    • SlashCommandDefinition

      public SlashCommandDefinition(@NotNull @NotNull ClassDescription classDescription, @NotNull @NotNull MethodDescription methodDescription, @NotNull @NotNull Collection<String> permissions, @NotNull @NotNull String name, @NotNull @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull @NotNull Set<net.dv8tion.jda.api.Permission> enabledPermissions, @NotNull @NotNull net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction localizationFunction, @NotNull @NotNull String description, @NotNull @NotNull SequencedCollection<OptionDataDefinition> commandOptions, @NotNull @NotNull SlashCommandDefinition.CooldownDefinition cooldown, boolean isAutoComplete)
      Creates an instance of a SlashCommandDefinition record class.
      Parameters:
      classDescription - the value for the classDescription record component
      methodDescription - the value for the methodDescription record component
      permissions - the value for the permissions record component
      name - the value for the name record component
      scope - the value for the scope record component
      guildOnly - the value for the guildOnly record component
      nsfw - the value for the nsfw record component
      enabledPermissions - the value for the enabledPermissions record component
      localizationFunction - the value for the localizationFunction record component
      description - the value for the description record component
      commandOptions - the value for the commandOptions record component
      cooldown - the value for the cooldown record component
      isAutoComplete - the value for the isAutoComplete record component
  • Method Details

    • build

      @NotNull public static @NotNull Optional<SlashCommandDefinition> build(MethodBuildContext context)
      Builds a new SlashCommandDefinition from the given MethodBuildContext.
      Returns:
      an Optional holding the SlashCommandDefinition
    • toJDAEntity

      @NotNull public @NotNull net.dv8tion.jda.api.interactions.commands.build.SlashCommandData toJDAEntity()
      Transforms this definition into SlashCommandData.
      Specified by:
      toJDAEntity in interface JDAEntity<net.dv8tion.jda.api.interactions.commands.build.CommandData>
      Returns:
      the SlashCommandData
    • toSubCommandData

      public net.dv8tion.jda.api.interactions.commands.build.SubcommandData toSubCommandData(String label)
      Transforms this definition into SubcommandData.
      Returns:
      the SubcommandData
    • displayName

      @NotNull public @NotNull String displayName()
      Description copied from interface: Definition
      The human-readable name of this definition.
      Specified by:
      displayName in interface Definition
    • commandType

      @NotNull public net.dv8tion.jda.api.interactions.commands.Command.Type commandType()
      Description copied from interface: CommandDefinition
      The Command.Type of this command.
      Specified by:
      commandType in interface CommandDefinition
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • classDescription

      @NotNull public @NotNull ClassDescription classDescription()
      Returns the value of the classDescription record component.
      Specified by:
      classDescription in interface Invokable
      Returns:
      the value of the classDescription record component
    • methodDescription

      @NotNull public @NotNull MethodDescription methodDescription()
      Returns the value of the methodDescription record component.
      Specified by:
      methodDescription in interface Invokable
      Returns:
      the value of the methodDescription record component
    • permissions

      @NotNull public @NotNull Collection<String> permissions()
      Returns the value of the permissions record component.
      Specified by:
      permissions in interface InteractionDefinition
      Returns:
      the value of the permissions record component
    • name

      @NotNull public @NotNull String name()
      Returns the value of the name record component.
      Specified by:
      name in interface CommandDefinition
      Returns:
      the value of the name record component
    • scope

      @NotNull public @NotNull CommandScope scope()
      Returns the value of the scope record component.
      Specified by:
      scope in interface CommandDefinition
      Returns:
      the value of the scope record component
    • guildOnly

      public boolean guildOnly()
      Returns the value of the guildOnly record component.
      Specified by:
      guildOnly in interface CommandDefinition
      Returns:
      the value of the guildOnly record component
    • nsfw

      public boolean nsfw()
      Returns the value of the nsfw record component.
      Specified by:
      nsfw in interface CommandDefinition
      Returns:
      the value of the nsfw record component
    • enabledPermissions

      @NotNull public @NotNull Set<net.dv8tion.jda.api.Permission> enabledPermissions()
      Returns the value of the enabledPermissions record component.
      Specified by:
      enabledPermissions in interface CommandDefinition
      Returns:
      the value of the enabledPermissions record component
    • localizationFunction

      @NotNull public @NotNull net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction localizationFunction()
      Returns the value of the localizationFunction record component.
      Specified by:
      localizationFunction in interface CommandDefinition
      Returns:
      the value of the localizationFunction record component
    • description

      @NotNull public @NotNull String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • commandOptions

      @NotNull public @NotNull SequencedCollection<OptionDataDefinition> commandOptions()
      Returns the value of the commandOptions record component.
      Returns:
      the value of the commandOptions record component
    • cooldown

      @NotNull public @NotNull SlashCommandDefinition.CooldownDefinition cooldown()
      Returns the value of the cooldown record component.
      Returns:
      the value of the cooldown record component
    • isAutoComplete

      public boolean isAutoComplete()
      Returns the value of the isAutoComplete record component.
      Returns:
      the value of the isAutoComplete record component