Interface ICustomId
- All Superinterfaces:
Component
- All Known Subinterfaces:
ActionComponent, AttachmentUpload, Button, EntitySelectMenu, SelectMenu, StringSelectMenu, TextInput
Component which has an associated custom id.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Component
Component.Type -
Method Summary
Modifier and TypeMethodDescriptionAn unique component ID ornull.withUniqueId(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface Component
getType, getUniqueId, isMessageCompatible, isModalCompatible
-
Method Details
-
getCustomId
An 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).- Returns:
- The component ID or null if not present
- See Also:
-
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- Parameters:
uniqueId- The new ID; must be higher or equal to 1- Returns:
- The new component
-