-
Notifications
You must be signed in to change notification settings - Fork 141
feat: components v2 #1294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: components v2 #1294
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t` for now to avoid shadowing
…omponent` more specific
this enum isn't documented/named separately in the current release docs anyway, it was only part of the initial alpha types
…tch ActionRow also sort attributes to have `children` first because it was driving me insane with how inconsistent it turned out over time
…nents, raise if other content fields used
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Summary
discord/discord-api-docs@af1843d
This implements the new v2 components, including:
Section
: displays a thumbnail or button next to some textTextDisplay
: plaintext, but as a componentMediaGallery
: gallery/mosaic for up to 10 imagesFile
: non-image attachmentsSeparator
: vertical spacer/separatorContainer
: can be considered similar to anEmbed
These new components are all non-interactive and intended for layout only, they are quite a bit more flexible than the previous
content
/embeds
/attachments
/components
combo, and allow for much nicer looking/better structured messages.Scope
I feel like it's worth clarifying that this is about as straightforward as the interface could be, only building on the existing implementation/functionality for components. There may very well be better ways (in terms of DX) to implement these components (namely, builder pattern, yippee), but I've considered this out of scope from the start.
I've intentionally not implemented support for the new components in
View
s, given the intended scope of this PR and the complexities that somehow integrating them would bring, especially since all of the components are non-interactive.The goal with this PR was to get just about the most basic implementation going, any further work building on top of it will be in separate future PRs.
Example
code
Checklist
pdm lint
pdm pyright