Record Class ContextCommandDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.ContextCommandDefinition
- 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 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
,com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
,JDAEntity<CommandData>
,CommandDefinition
,InteractionDefinition
public record ContextCommandDefinition(@NotNull ClassDescription clazzDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String name, Command.Type commandType, @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull Set<Permission> enabledPermissions, @NotNull 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
Fields inherited from interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
log
-
Constructor Summary
ConstructorDescriptionContextCommandDefinition
(@NotNull ClassDescription clazzDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String name, Command.Type commandType, @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull Set<Permission> enabledPermissions, @NotNull 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 theclazzDescription
record component.Returns the value of thecommandType
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.@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 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
Methods inherited from interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
invoke
-
Constructor Details
-
ContextCommandDefinition
public ContextCommandDefinition(@NotNull @NotNull ClassDescription clazzDescription, @NotNull @NotNull MethodDescription methodDescription, @NotNull @NotNull Collection<String> permissions, @NotNull @NotNull String name, @NotNull Command.Type commandType, @NotNull @NotNull CommandScope scope, boolean guildOnly, boolean nsfw, @NotNull @NotNull Set<Permission> enabledPermissions, @NotNull @NotNull LocalizationFunction localizationFunction) Creates an instance of aContextCommandDefinition
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 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
Transforms this definition intoCommandData
.- Specified by:
toJDAEntity
in interfaceJDAEntity<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. -
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
-
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
Returns the value of thelocalizationFunction
record component.- Specified by:
localizationFunction
in interfaceCommandDefinition
- Returns:
- the value of the
localizationFunction
record component
-