Record Class ContextCommandDefinition

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.ContextCommandDefinition
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
commandType - the Command.Type of this 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
All Implemented Interfaces:
Definition, Invokable, JDAEntity<net.dv8tion.jda.api.interactions.commands.build.CommandData>, CommandDefinition, InteractionDefinition

public record ContextCommandDefinition(@NotNull ClassDescription classDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String name, net.dv8tion.jda.api.interactions.commands.Command.Type commandType, @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) extends Record implements CommandDefinition
Representation of a context command.
  • Constructor Details

    • ContextCommandDefinition

      public ContextCommandDefinition(@NotNull @NotNull ClassDescription classDescription, @NotNull @NotNull MethodDescription methodDescription, @NotNull @NotNull Collection<String> permissions, @NotNull @NotNull String name, @NotNull net.dv8tion.jda.api.interactions.commands.Command.Type commandType, @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)
      Creates an instance of a ContextCommandDefinition 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
      commandType - the value for the commandType 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
  • Method Details

    • build

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

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

      @NotNull public @NotNull String displayName()
      Description copied from interface: Definition
      The human-readable name of this definition.
      Specified by:
      displayName in interface Definition
    • 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
    • commandType

      @NotNull public net.dv8tion.jda.api.interactions.commands.Command.Type commandType()
      Returns the value of the commandType record component.
      Specified by:
      commandType in interface CommandDefinition
      Returns:
      the value of the commandType 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