Interface RadioGroup
- All Superinterfaces:
Component, ICustomId, LabelChildComponent
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface Component
Component.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum length of a radio group's custom ID.static final intThe maximum number of options a radio group can have. -
Method Summary
Modifier and TypeMethodDescriptionstatic RadioGroup.BuilderCreates a new radio group builder with the provided custom ID.default RadioGroup.BuilderCreates a new preconfiguredRadioGroup.Builderwith the same settings used for this radio group.An unique component ID ornull.@Unmodifiable List<RadioGroupOption> Returns an immutable list of the options available for this radio group.booleanWhether this radio group requires an option to be selected.withUniqueId(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface Component
getType, getUniqueId, isMessageCompatible, isModalCompatible
-
Field Details
-
CUSTOM_ID_MAX_LENGTH
static final int CUSTOM_ID_MAX_LENGTHThe maximum length of a radio group's custom ID. (100)- See Also:
-
OPTIONS_MAX_AMOUNT
static final int OPTIONS_MAX_AMOUNTThe maximum number of options a radio group can have. (10)- See Also:
-
-
Method Details
-
withUniqueId
Description copied from interface:ComponentCreates a new component with the provided numeric ID.
If no ID is set, Discord will generate IDs incrementally starting from 1 and will not use existing IDs from the same message/modal.- Specified by:
withUniqueIdin interfaceComponent- Specified by:
withUniqueIdin interfaceICustomId- Specified by:
withUniqueIdin interfaceLabelChildComponent- Parameters:
uniqueId- The new ID; must be higher or equal to 1- Returns:
- The new component
-
getCustomId
Description copied from interface:ICustomIdAn unique component ID ornull.
Some components such as link buttons don't have this.Custom IDs can contain custom data, this is typically used to pass data between a slash command and your button listener.
While this ID is unique and can be retrieved with
ComponentInteraction.getComponentId(), you should useComponent.getUniqueId()to identify a component in a single message, such as when replacing components usingComponentTreeorIReplaceable.replace(ComponentReplacer).- Specified by:
getCustomIdin interfaceICustomId- Returns:
- The component ID or null if not present
- See Also:
-
getOptions
Returns an immutable list of the options available for this radio group.- Returns:
- Immutable list of this radio group's options
-
isRequired
boolean isRequired()Whether this radio group requires an option to be selected.- Returns:
trueif an option must be selected by the user
-
create
Creates a new radio group builder with the provided custom ID.- Parameters:
customId- The custom ID, can be used to pass data to handlers- Returns:
- The new builder
- Throws:
IllegalArgumentException- If the ID isnullor blank
-
createCopy
Creates a new preconfiguredRadioGroup.Builderwith the same settings used for this radio group.
This can be useful to create an updated version of this radio group without needing to rebuild it from scratch.- Returns:
- The
RadioGroup.Builderused to create the radio group
-