Skip to content

Conversation

@valzargaming
Copy link
Member

@valzargaming valzargaming commented Nov 24, 2025

This pull request refactors the Discord component builder classes to consistently use the ComponentObject class for type constants and utility methods, instead of the older Component class. This change improves code clarity and future-proofs the codebase by centralizing component type definitions and related utilities. Additionally, the update introduces an alias for available component types and ensures deprecation notices reference the new standard.

Refactoring to use ComponentObject for type constants and utilities:

  • Replaced all instances of Component::TYPE_* with ComponentObject::TYPE_* in component classes such as ActionRow, Button, ChannelSelect, Container, File, FileUpload, Label, MediaGallery, MentionableSelect, RoleSelect, Section, SelectMenu, Separator, StringSelect, TextDisplay, TextInput, Thumbnail, and UserSelect. This also includes updating checks and assignments that previously used the old constants. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]

  • Updated deprecation and usage comments to reference ComponentObject instead of Component (e.g., for Label and select menu types). [1] [2] [3]

Centralization of component type mappings:

  • Added an alias TYPES in ComponentObject that references ComponentPart::TYPES, providing a single source of truth for available component types. [1] [2]

@valzargaming valzargaming requested a review from a team November 24, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants