-
-
Notifications
You must be signed in to change notification settings - Fork 473
feat: components v2 #2707
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?
feat: components v2 #2707
Conversation
thank u for proofreading Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: plun1331 <plun1331@gmail.com>
When using a decorator in a container, should the items appear above or below items set in |
Can row not be used? But I would say below when not specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disable_all_items
and enable_all_items
need to be updated
@@ -1605,6 +1605,8 @@ async def send( | |||
) | |||
|
|||
components = view.to_components() | |||
if view.is_components_v2(): | |||
flags.is_components_v2 = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add an error here if content
or embeds
are provided, because some of the discord errors aren't very clear
|
||
class File(Item[V]): | ||
"""Represents a UI File. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. note:: | |
This component does not show media previews. Use :class:`MediaGallery` for previews instead. | |
.. versionadded:: 2.7 | ||
|
||
Parameters | ||
---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameters
Parameters | ||
---------- | ||
*items: :class:`MediaGalleryItem` | ||
The initial items contained in this gallery, up to 10. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document id
---------- | ||
content: :class:`str` | ||
The text display's content. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document id
.. versionadded:: 2.7 | ||
|
||
Parameters | ||
---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameters
if view is not MISSING: | ||
payload["components"] = view.to_components() if view is not None else [] | ||
if view and view.is_components_v2(): | ||
flags.is_components_v2 = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error if content
or embeds
are sent with this flag enabled
@button(label="Delete Message", style=ButtonStyle.red, id=200) | ||
async def delete_button(self, button: Button, interaction: Interaction): | ||
await interaction.response.defer(invisible=True) | ||
await interaction.delete_original_response() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await interaction.delete_original_response() | |
await interaction.message.delete() | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think officially delete_original_response
is recommended because defer is a response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete_original_response
deletes whatever response you sent, it looks like what you want is to delete the message the button is on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having an edit button would be more useful in this scenario anyways, then the id
functionality can be shown. That change can be made in a future PR though.
Co-authored-by: plun1331 <plun1331@gmail.com> Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: plun1331 <plun1331@gmail.com> Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: Paillat <jeremiecotti@ik.me> Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: Paillat <jeremiecotti@ik.me> Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
@@ -137,6 +137,7 @@ def add_item(self, item: Item) -> None: | |||
|
|||
self.items.append(item) | |||
self._add_component_from_item(item) | |||
return self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return types need to be changed to typing.Self
Summary
Soon
Temporary reference: https://github.com/Lulalaby/discord-api-docs/blob/comp_v2/docs/interactions/Message_Components.md#v2-components
Official PR for the docs is available now at Components v2 discord/discord-api-docs#7487
Information
examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.Reference: