-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Components V2 #10166
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
base: master
Are you sure you want to change the base?
Components V2 #10166
Conversation
… initialization on UnfurledAttachment
TextDisplay attribute error when doing TextDisplay.to_component_dict() View.to_components() appending Item objects instead of Item.to_component_dict() Changed View.to_components() sorting key
…nto feat/components-v2
With these changes is there a straightforward way to send the simplest form of a components v2 message, aka just plaintext content? The reason for wanting this is because the character limit would be 4000 instead of the old 2000. It would be nice if the character limit of the existing "content" field was increased to 4000; and just make it use components v2 under the hood if it has to. |
You can make your own LayoutView subclass and automatically assign it a content with a TextDisplay, as making content be a shortcut for TextDisplay would make it not be consistent with the API. |
Yes I tried and I get [ ] |
Code? Also, consider joining the support server and reporting this in the dedicated discussion thread. |
I had forgotten to |
Summary
Adds support for discord's components v2.
Testing and bug reporting is very much appreciated!
DDevs PR: discord/discord-api-docs#7487
SectionComponent
->ui.Section
TextDisplay
->ui.TextDisplay
ThumbnailComponent
->ui.Thumbnail
MediaGalleryComponent
->ui.MediaGallery
FileComponent
->ui.File
SeparatorComponent
->ui.Separator
Container
->ui.Container
ActionRow
->ui.ActionRow
ui.LayoutView
, that allows for these components to exist.id
attribute to all Components and UI Components.-> This also adds the
get_item_by_id
method toui.View
,ui.LayoutView
,ui.Container
, andui.Section
.ui.View
in favour ofui.LayoutView
.These changes have been tested with the following snippets:
All of these use the jishaku package
Sending Components v2
Code:
Result (as expected):

Sending Components v2 items on webhooks
1st snippet: sends interactible items on app owned and not app owned webhooks
Result (as expected):

2nd snippet: sends non-interactible items on not app owned webhook
Result (as expected):

Receiving other message's components v2
Code:
Result (as expected):

Checklist