Record Class ContextCommandDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.ContextCommandDefinition
- 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 commandcommandType
- theCommand.Type
of this 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 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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.kaktushose.jda.commands.definitions.interactions.InteractionDefinition
InteractionDefinition.ReplyConfig
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionContextCommandDefinition
(@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) Creates an instance of aContextCommandDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Optional
<ContextCommandDefinition> build
(MethodBuildContext context) Builds a newContextCommandDefinition
from the givenMethodBuildContext
.@NotNull ClassDescription
Returns the value of theclassDescription
record component.net.dv8tion.jda.api.interactions.commands.Command.Type
Returns the value of thecommandType
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.@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.CommandData
Transforms this definition intoCommandData
.final String
toString()
Returns a string representation of this record class.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
-
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 aContextCommandDefinition
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 componentcommandType
- the value for thecommandType
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 component
-
-
Method Details
-
build
@NotNull public static @NotNull Optional<ContextCommandDefinition> build(MethodBuildContext context) Builds a newContextCommandDefinition
from the givenMethodBuildContext
.- Returns:
- an
Optional
holding theContextCommandDefinition
-
toJDAEntity
@NotNull public @NotNull net.dv8tion.jda.api.interactions.commands.build.CommandData toJDAEntity()Transforms this definition intoCommandData
.- Specified by:
toJDAEntity
in interfaceJDAEntity<net.dv8tion.jda.api.interactions.commands.build.CommandData>
- Returns:
- the
CommandData
-
displayName
Description copied from interface:Definition
The human-readable name of this definition.- Specified by:
displayName
in interfaceDefinition
-
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
-
commandType
@NotNull public net.dv8tion.jda.api.interactions.commands.Command.Type commandType()Returns the value of thecommandType
record component.- Specified by:
commandType
in interfaceCommandDefinition
- Returns:
- the value of the
commandType
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
-