-
Notifications
You must be signed in to change notification settings - Fork 138
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
feat(components): support premium buttons #1276
base: master
Are you sure you want to change the base?
Conversation
This updates the workaround added in 41618b1, which attempts to preserve the row of url buttons. This already technically worked for premium buttons too, but only due to a bug in that previous implementation. Still, this remains an awful workaround. It may be easier to only update the components directly, and leave `self.children` as is, ignoring additions/removals (which shouldn't happen here in the first place). Alternatively, the new `id` field could also work, though it's currently still part of that other thing and not public.
Can we please model SKU and URL buttons as distinct types 🙏 |
@@ -53,7 +53,7 @@ class Button(Item[V_co]): | |||
The style of the button. | |||
custom_id: Optional[:class:`str`] | |||
The ID of the button that gets received during an interaction. | |||
If this button is for a URL, it does not have a custom ID. | |||
If this button is for a URL or an SKU, it does not have a custom ID. |
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.
If this button is for a URL or an SKU, it does not have a custom ID. | |
If this button is for a URL or a SKU, it does not have a custom ID. |
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 believe this was brought up at some point before; it depends on whether one pronounces "SKU" as individual letters (i.e. "S - K - U") or as one word (i.e. something like "skew"), and both are apparently valid:
- https://dictionary.cambridge.org/pronunciation/english/sku
- https://en.wiktionary.org/wiki/SKU (includes IPA for both)
I personally tend more towards the former pronounciation, and it's in line with the (admittedly few) occurrences already in the library, but the latter would be correct too, as far as I can tell.
@@ -169,7 +183,7 @@ def style(self, value: ButtonStyle) -> None: | |||
def custom_id(self) -> Optional[str]: | |||
"""Optional[:class:`str`]: The ID of the button that gets received during an interaction. | |||
|
|||
If this button is for a URL, it does not have a custom ID. | |||
If this button is for a URL or an SKU, it does not have a custom ID. |
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.
If this button is for a URL or an SKU, it does not have a custom ID. | |
If this button is for a URL or a SKU, it does not have a custom ID. |
@@ -184,7 +184,7 @@ class Button(Component): | |||
The style of the button. | |||
custom_id: Optional[:class:`str`] | |||
The ID of the button that gets received during an interaction. | |||
If this button is for a URL, it does not have a custom ID. | |||
If this button is for a URL or an SKU, it does not have a custom ID. |
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.
If this button is for a URL or an SKU, it does not have a custom ID. | |
If this button is for a URL or a SKU, it does not have a custom ID. |
Co-authored-by: Eneg <42005170+Enegg@users.noreply.github.com> Signed-off-by: vi <8530778+shiftinv@users.noreply.github.com>
I suppose |
yup, thanks! 0636ffe |
Summary
This adds support for premium buttons via
ButtonStyle.premium
andui.Button.sku_id
, and deprecatesInteractionResponse.require_premium
1.discord/discord-api-docs@4853fbc
Checklist
pdm lint
pdm pyright
Footnotes
Looks like this response type does not work at all anymore, contrary to the documentation and changelog, which claim "This will continue to function but may be eventually unsupported.". This makes it already a breaking change on Discord's end, so no point in making it even more breaking here. Still, it could honestly just be removed. ↩