Use non-deprecated classes #1435
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the Discord component builder classes to consistently use the
ComponentObjectclass for type constants and utility methods, instead of the olderComponentclass. 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
ComponentObjectfor type constants and utilities:Replaced all instances of
Component::TYPE_*withComponentObject::TYPE_*in component classes such asActionRow,Button,ChannelSelect,Container,File,FileUpload,Label,MediaGallery,MentionableSelect,RoleSelect,Section,SelectMenu,Separator,StringSelect,TextDisplay,TextInput,Thumbnail, andUserSelect. 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
ComponentObjectinstead ofComponent(e.g., forLabeland select menu types). [1] [2] [3]Centralization of component type mappings:
TYPESinComponentObjectthat referencesComponentPart::TYPES, providing a single source of truth for available component types. [1] [2]