Skip to content

Conversation

valzargaming
Copy link
Member

@valzargaming valzargaming commented Aug 7, 2025

This pull request introduces support for Discord's new Label component type, deprecates the use of ActionRow as the top-level container in modals, and adds improved handling for required select menu components in modals. The changes update several classes to reflect these new features and deprecations, ensuring better alignment with Discord's evolving component API.

New Label Component Support:

  • Added new Label component classes in both builders (src/Discord/Builders/Components/Label.php) and parts (src/Discord/Parts/Channel/Message/Label.php) to support Discord's top-level label container for modals. This includes serialization logic and usage documentation. [1] [2]
  • Registered TYPE_LABEL (value 18) in the Component type constants and component mapping, allowing the system to recognize and instantiate Label components. [1] [2]

Deprecation and Migration Guidance:

  • Deprecated the use of ActionRow as the top-level container in modals, recommending Component::Label instead. Updated documentation and comments in relevant files to reflect this change. [1] [2]
  • Marked the label property in TextInput as deprecated for modals, since labels should now be provided by the new Label component. Updated constructor and setter to make the label optional. [1] [2] [3] [4] [5]

Required Select Menu Improvements (Modal Only):

  • Added setRequired methods to StringSelect, RoleSelect, UserSelect, and MentionableSelect to support marking select menus as required in modals. Updated serialization logic to enforce minimum value constraints for required selects. [1] [2] [3] [4] [5] [6]
  • Allowed StringSelect components to be used in modals, expanding their usage beyond messages.

Interaction Handling Updates:

  • Updated modal interaction logic to support the new Label container, ensuring that components within labels are correctly extracted and processed when handling modal submissions.

Minor Consistency and Documentation Updates:

  • Improved docblocks, inheritance annotations, and exception types for better clarity and consistency across components. [1] [2] [3]

Let me know if you want a deeper explanation of how to migrate existing modal code to use the new Label component or have questions about the required select menu changes.

@valzargaming valzargaming changed the title Select Menu support for Modals Label and Select Menu support for Modals Aug 7, 2025
@valzargaming valzargaming added api changes wait for discord Waiting for release by discord labels Aug 8, 2025
@valzargaming valzargaming merged commit 3305129 into master Aug 23, 2025
2 checks passed
@valzargaming valzargaming deleted the modal-select-menu branch August 23, 2025 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api changes wait for discord Waiting for release by discord
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant