Class SubcommandGroupData
- java.lang.Object
-
- net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData
-
- All Implemented Interfaces:
SerializableData
public class SubcommandGroupData extends java.lang.Object implements SerializableData
Builder for a Slash-Command group.
-
-
Constructor Summary
Constructors Constructor Description SubcommandGroupData(java.lang.String name, java.lang.String description)
Create an group builder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubcommandGroupData
addSubcommands(java.util.Collection<? extends SubcommandData> subcommands)
Add up to 25Subcommands
to this group.SubcommandGroupData
addSubcommands(SubcommandData... subcommands)
Add up to 25Subcommands
to this group.static SubcommandGroupData
fromData(DataObject json)
Parses the provided serialization back into an SubcommandGroupData instance.java.lang.String
getDescription()
The description for this subcommand groupjava.lang.String
getName()
The name for this subcommand groupjava.util.List<SubcommandData>
getSubcommands()
TheSubcommands
in this group.SubcommandGroupData
setDescription(java.lang.String description)
Configure the descriptionSubcommandGroupData
setName(java.lang.String name)
Configure the nameDataObject
toData()
SerializedDataObject
for this object.
-
-
-
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 charactersdescription
- 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
-
getSubcommands
@Nonnull public java.util.List<SubcommandData> getSubcommands()
TheSubcommands
in this group.- Returns:
- Immutable list of
SubcommandData
-
addSubcommands
@Nonnull public SubcommandGroupData addSubcommands(@Nonnull SubcommandData... subcommands)
Add up to 25Subcommands
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 25Subcommands
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
-
toData
@Nonnull public DataObject toData()
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
fromData
@Nonnull public static SubcommandGroupData fromData(@Nonnull DataObject json)
Parses the provided serialization back into an SubcommandGroupData instance.
This is the reverse function fortoData()
.- Parameters:
json
- The serializedDataObject
representing the group- Returns:
- The parsed SubcommandGroupData instance, which can be further configured through setters
- Throws:
ParsingException
- If the serialized object is missing required fieldsjava.lang.IllegalArgumentException
- If any of the values are failing the respective checks such as length
-
-