Class SubcommandGroupData

  • All Implemented Interfaces:
    SerializableData

    public class SubcommandGroupData
    extends java.lang.Object
    implements SerializableData
    Builder for a Slash-Command group.
    • Constructor Detail

      • SubcommandGroupData

        public SubcommandGroupData​(@Nonnull
                                   java.lang.String name,
                                   @Nonnull
                                   java.lang.String description)
        Create an group builder.
        Parameters:
        name - The group name, 1-32 lowercase alphanumeric characters
        description - The group description, 1-100 characters
        Throws:
        java.lang.IllegalArgumentException - If any of the following requirements are not met
        • The name must be lowercase alphanumeric (with dash), 1-32 characters long
        • The description must be 1-100 characters long
    • Method Detail

      • setName

        @Nonnull
        public SubcommandGroupData setName​(@Nonnull
                                           java.lang.String name)
        Configure the name
        Parameters:
        name - The lowercase alphanumeric (with dash) name, 1-32 characters
        Returns:
        The SubcommandGroupData instance, for chaining
        Throws:
        java.lang.IllegalArgumentException - If the name is null, not alphanumeric, or not between 1-32 characters
      • setDescription

        @Nonnull
        public SubcommandGroupData setDescription​(@Nonnull
                                                  java.lang.String description)
        Configure the description
        Parameters:
        description - The description, 1-100 characters
        Returns:
        The SubcommandGroupData instance, for chaining
        Throws:
        java.lang.IllegalArgumentException - If the name is null or not between 1-100 characters
      • getName

        @Nonnull
        public java.lang.String getName()
        The name for this subcommand group
        Returns:
        The name
      • getDescription

        @Nonnull
        public java.lang.String getDescription()
        The description for this subcommand group
        Returns:
        The description
      • addSubcommands

        @Nonnull
        public SubcommandGroupData addSubcommands​(@Nonnull
                                                  SubcommandData... subcommands)
        Add up to 25 Subcommands to this group.
        Parameters:
        subcommands - The subcommands to add
        Returns:
        The SubcommandGroupData instance, for chaining
        Throws:
        java.lang.IllegalArgumentException - If null is provided, or more than 25 subcommands are provided
      • addSubcommands

        @Nonnull
        public SubcommandGroupData addSubcommands​(@Nonnull
                                                  java.util.Collection<? extends SubcommandData> subcommands)
        Add up to 25 Subcommands to this group.
        Parameters:
        subcommands - The subcommands to add
        Returns:
        The SubcommandGroupData instance, for chaining
        Throws:
        java.lang.IllegalArgumentException - If null is provided, or more than 25 subcommands are provided
      • fromData

        @Nonnull
        public static SubcommandGroupData fromData​(@Nonnull
                                                   DataObject json)
        Parses the provided serialization back into an SubcommandGroupData instance.
        This is the reverse function for toData().
        Parameters:
        json - The serialized DataObject representing the group
        Returns:
        The parsed SubcommandGroupData instance, which can be further configured through setters
        Throws:
        ParsingException - If the serialized object is missing required fields
        java.lang.IllegalArgumentException - If any of the values are failing the respective checks such as length