Record Class CommandTree
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.internal.register.CommandTree
-
Constructor Summary
ConstructorsConstructorDescriptionCommandTree(TreeNode root) Creates an instance of aCommandTreerecord class.CommandTree(Collection<SlashCommandDefinition> commands) Constructs a new CommandTree from the givenSlashCommandDefinitions. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getSlashCommandData(LocalizationFunction localizationFunction) Transforms this CommandTree toSlashCommandDatabased on the tree structure.final inthashCode()Returns a hash code value for this object.root()Returns the value of therootrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
CommandTree
Constructs a new CommandTree from the given
SlashCommandDefinitions.The labels of the
SlashCommandDefinitions 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. -
CommandTree
Creates an instance of aCommandTreerecord class.- Parameters:
root- the value for therootrecord component
-
-
Method Details
-
getSlashCommandData
Transforms this CommandTree to
SlashCommandDatabased on the tree structure.More formally, a depth-first-search is performed to determine which commands should be registered as a slash command, a sub command group or a sub command.
- Returns:
- a
CollectionofSlashCommandData
-
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 therootrecord component.- Returns:
- the value of the
rootrecord component
-