Record Class SlashCommandDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.SlashCommandDefinition
- Record Components:
classDescription
- 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
,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.
-
Nested Class Summary
Nested ClassesModifier 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
-
Constructor Summary
ConstructorsConstructorDescriptionSlashCommandDefinition
(@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) 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 theclassDescription
record component.@NotNull SequencedCollection
<OptionDataDefinition> Returns the value of thecommandOptions
record component.net.dv8tion.jda.api.interactions.commands.Command.Type
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
<net.dv8tion.jda.api.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 net.dv8tion.jda.api.interactions.commands.localization.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 net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
Transforms this definition intoSlashCommandData
.final String
toString()
Returns a string representation of this record class.net.dv8tion.jda.api.interactions.commands.build.SubcommandData
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
-
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 aSlashCommandDefinition
record class.- Parameters:
classDescription
- the value for theclassDescription
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
@NotNull public @NotNull net.dv8tion.jda.api.interactions.commands.build.SlashCommandData toJDAEntity()Transforms this definition intoSlashCommandData
.- Specified by:
toJDAEntity
in interfaceJDAEntity<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 intoSubcommandData
.- Returns:
- the
SubcommandData
-
displayName
Description copied from interface:Definition
The human-readable name of this definition.- Specified by:
displayName
in interfaceDefinition
-
commandType
@NotNull public net.dv8tion.jda.api.interactions.commands.Command.Type 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. -
classDescription
Returns the value of theclassDescription
record component.- Specified by:
classDescription
in interfaceInvokable
- Returns:
- the value of the
classDescription
record component
-
methodDescription
Returns the value of themethodDescription
record component.- Specified by:
methodDescription
in interfaceInvokable
- 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
@NotNull public @NotNull net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction 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
-