Record Class SlashCommandDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.SlashCommandDefinition
- Record Components:
clazzDescription
- theClassDescription
of the declaring class of themethodDescription()
methodDescription
- theMethodDescription
of the method this definition is bound topermissions
- aCollection
of permissions for this commandname
- the name of the commandscope
- theCommandScope
of this commandguildOnly
- whether this command can only be executed in guildsnsfw
- whether this command is nsfwenabledPermissions
- a possibly-emptySet
ofPermission
s this command will be enabled forlocalizationFunction
- theLocalizationFunction
to use for this commanddescription
- the command descriptioncommandOptions
- aSequencedCollection
ofOptionDataDefinition
scooldown
- the correspondingSlashCommandDefinition.CooldownDefinition
isAutoComplete
- whether this command supports auto complete
- All Implemented Interfaces:
Definition
,com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
,JDAEntity<CommandData>
,CommandDefinition
,InteractionDefinition
public record SlashCommandDefinition(@NotNull ClassDescription clazzDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String name, @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull Set<Permission> enabledPermissions, @NotNull LocalizationFunction localizationFunction, @NotNull String description, @NotNull SequencedCollection<OptionDataDefinition> commandOptions, @NotNull SlashCommandDefinition.CooldownDefinition cooldown, boolean isAutoComplete)
extends Record
implements CommandDefinition
Representation of a slash command.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Representation of a cooldown definition defined byCooldown
.Nested classes/interfaces inherited from interface com.github.kaktushose.jda.commands.definitions.interactions.InteractionDefinition
InteractionDefinition.ReplyConfig
-
Field Summary
Fields inherited from interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
log
-
Constructor Summary
ConstructorDescriptionSlashCommandDefinition
(@NotNull ClassDescription clazzDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String name, @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull Set<Permission> enabledPermissions, @NotNull LocalizationFunction localizationFunction, @NotNull String description, @NotNull SequencedCollection<OptionDataDefinition> commandOptions, @NotNull SlashCommandDefinition.CooldownDefinition cooldown, boolean isAutoComplete) Creates an instance of aSlashCommandDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Optional
<SlashCommandDefinition> build
(MethodBuildContext context) Builds a newSlashCommandDefinition
from the givenMethodBuildContext
.@NotNull ClassDescription
Returns the value of theclazzDescription
record component.@NotNull SequencedCollection
<OptionDataDefinition> Returns the value of thecommandOptions
record component.TheCommand.Type
of this command.cooldown()
Returns the value of thecooldown
record component.@NotNull String
Returns the value of thedescription
record component.@NotNull String
The human-readable name of this definition.@NotNull Set
<Permission> Returns the value of theenabledPermissions
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
Returns the value of theguildOnly
record component.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisAutoComplete
record component.@NotNull LocalizationFunction
Returns the value of thelocalizationFunction
record component.@NotNull MethodDescription
Returns the value of themethodDescription
record component.@NotNull String
name()
Returns the value of thename
record component.boolean
nsfw()
Returns the value of thensfw
record component.@NotNull Collection
<String> Returns the value of thepermissions
record component.@NotNull CommandScope
scope()
Returns the value of thescope
record component.@NotNull SlashCommandData
Transforms this definition intoSlashCommandData
.final String
toString()
Returns a string representation of this record class.toSubCommandData
(String label) Transforms this definition intoSubcommandData
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.github.kaktushose.jda.commands.definitions.interactions.InteractionDefinition
definitionId, newInstance, replyConfig
Methods inherited from interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
invoke
-
Constructor Details
-
SlashCommandDefinition
public SlashCommandDefinition(@NotNull @NotNull ClassDescription clazzDescription, @NotNull @NotNull MethodDescription methodDescription, @NotNull @NotNull Collection<String> permissions, @NotNull @NotNull String name, @NotNull @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull @NotNull Set<Permission> enabledPermissions, @NotNull @NotNull LocalizationFunction localizationFunction, @NotNull @NotNull String description, @NotNull @NotNull SequencedCollection<OptionDataDefinition> commandOptions, @NotNull @NotNull SlashCommandDefinition.CooldownDefinition cooldown, boolean isAutoComplete) Creates an instance of aSlashCommandDefinition
record class.- Parameters:
clazzDescription
- the value for theclazzDescription
record componentmethodDescription
- the value for themethodDescription
record componentpermissions
- the value for thepermissions
record componentname
- the value for thename
record componentscope
- the value for thescope
record componentguildOnly
- the value for theguildOnly
record componentnsfw
- the value for thensfw
record componentenabledPermissions
- the value for theenabledPermissions
record componentlocalizationFunction
- the value for thelocalizationFunction
record componentdescription
- the value for thedescription
record componentcommandOptions
- the value for thecommandOptions
record componentcooldown
- the value for thecooldown
record componentisAutoComplete
- the value for theisAutoComplete
record component
-
-
Method Details
-
build
Builds a newSlashCommandDefinition
from the givenMethodBuildContext
.- Returns:
- an
Optional
holding theSlashCommandDefinition
-
toJDAEntity
Transforms this definition intoSlashCommandData
.- Specified by:
toJDAEntity
in interfaceJDAEntity<CommandData>
- Returns:
- the
SlashCommandData
-
toSubCommandData
Transforms this definition intoSubcommandData
.- Returns:
- the
SubcommandData
-
displayName
Description copied from interface:Definition
The human-readable name of this definition.- Specified by:
displayName
in interfaceDefinition
-
commandType
Description copied from interface:CommandDefinition
TheCommand.Type
of this command.- Specified by:
commandType
in interfaceCommandDefinition
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
clazzDescription
Returns the value of theclazzDescription
record component.- Specified by:
clazzDescription
in interfacecom.github.kaktushose.jda.commands.definitions.features.internal.Invokable
- Returns:
- the value of the
clazzDescription
record component
-
methodDescription
Returns the value of themethodDescription
record component.- Specified by:
methodDescription
in interfacecom.github.kaktushose.jda.commands.definitions.features.internal.Invokable
- Returns:
- the value of the
methodDescription
record component
-
permissions
Returns the value of thepermissions
record component.- Specified by:
permissions
in interfaceInteractionDefinition
- Returns:
- the value of the
permissions
record component
-
name
Returns the value of thename
record component.- Specified by:
name
in interfaceCommandDefinition
- Returns:
- the value of the
name
record component
-
scope
Returns the value of thescope
record component.- Specified by:
scope
in interfaceCommandDefinition
- Returns:
- the value of the
scope
record component
-
guildOnly
public boolean guildOnly()Returns the value of theguildOnly
record component.- Specified by:
guildOnly
in interfaceCommandDefinition
- Returns:
- the value of the
guildOnly
record component
-
nsfw
public boolean nsfw()Returns the value of thensfw
record component.- Specified by:
nsfw
in interfaceCommandDefinition
- Returns:
- the value of the
nsfw
record component
-
enabledPermissions
Returns the value of theenabledPermissions
record component.- Specified by:
enabledPermissions
in interfaceCommandDefinition
- Returns:
- the value of the
enabledPermissions
record component
-
localizationFunction
Returns the value of thelocalizationFunction
record component.- Specified by:
localizationFunction
in interfaceCommandDefinition
- Returns:
- the value of the
localizationFunction
record component
-
description
Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-
commandOptions
Returns the value of thecommandOptions
record component.- Returns:
- the value of the
commandOptions
record component
-
cooldown
-
isAutoComplete
public boolean isAutoComplete()Returns the value of theisAutoComplete
record component.- Returns:
- the value of the
isAutoComplete
record component
-