Record Class CommandTree
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.internal.register.CommandTree
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty CommandTree.CommandTree
(TreeNode root) Creates an instance of aCommandTree
record class.CommandTree
(Collection<SlashCommandDefinition> commands) Constructs a new CommandTree. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(SlashCommandDefinition command) Adds aSlashCommandDefinition
to theCommandTree
.void
addAll
(Collection<SlashCommandDefinition> commands) final boolean
Indicates whether some other object is "equal to" this one.List
<net.dv8tion.jda.api.interactions.commands.build.SlashCommandData> Gets allSlashCommandData
.This will only return theSlashCommandData
of the leaf nodes.getNames()
Gets the sanitized labels of allSlashCommandData
returned bygetCommands()
.final int
hashCode()
Returns a hash code value for this object.root()
Returns the value of theroot
record component.toString()
Returns a string representation of this record class.
-
Constructor Details
-
CommandTree
public CommandTree()Constructs an empty CommandTree. -
CommandTree
Constructs a new CommandTree. -
CommandTree
Creates an instance of aCommandTree
record class.- Parameters:
root
- the value for theroot
record component
-
-
Method Details
-
add
Adds aSlashCommandDefinition
to theCommandTree
. The label of theSlashCommandDefinition
will be sanitized to match the regex^[\w-]+$
. Furthermore, if the label consists of more than three spaces any additional space will be replaced with_
due to Discords limitations on SubcommandGroups.- Parameters:
command
- theSlashCommandDefinition
to add
-
addAll
- Parameters:
commands
- aCollection
ofSlashCommandDefinition
s to add- See Also:
-
getCommands
-
getNames
Gets the sanitized labels of allSlashCommandData
returned bygetCommands()
. The labels will match the regex^[\w-]+$
. Furthermore, if the label consists of more than three spaces any additional space will be replaced with_
due to Discords limitations on SubcommandGroups.- Returns:
- a
List
of labels
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
root
Returns the value of theroot
record component.- Returns:
- the value of the
root
record component
-