mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
Add ButtonStyle.premium
This commit is contained in:
@ -170,6 +170,10 @@ class Button(Component):
|
||||
The label of the button, if any.
|
||||
emoji: Optional[:class:`PartialEmoji`]
|
||||
The emoji of the button, if available.
|
||||
sku_id: Optional[:class:`int`]
|
||||
The SKU ID this button sends you to, if available.
|
||||
|
||||
.. versionadded:: 2.4
|
||||
"""
|
||||
|
||||
__slots__: Tuple[str, ...] = (
|
||||
@ -179,6 +183,7 @@ class Button(Component):
|
||||
'disabled',
|
||||
'label',
|
||||
'emoji',
|
||||
'sku_id',
|
||||
)
|
||||
|
||||
__repr_info__: ClassVar[Tuple[str, ...]] = __slots__
|
||||
@ -195,6 +200,11 @@ class Button(Component):
|
||||
except KeyError:
|
||||
self.emoji = None
|
||||
|
||||
try:
|
||||
self.sku_id: Optional[int] = int(data['sku_id'])
|
||||
except KeyError:
|
||||
self.sku_id = None
|
||||
|
||||
@property
|
||||
def type(self) -> Literal[ComponentType.button]:
|
||||
""":class:`ComponentType`: The type of component."""
|
||||
@ -207,6 +217,9 @@ class Button(Component):
|
||||
'disabled': self.disabled,
|
||||
}
|
||||
|
||||
if self.sku_id:
|
||||
payload['sku_id'] = str(self.sku_id)
|
||||
|
||||
if self.label:
|
||||
payload['label'] = self.label
|
||||
|
||||
|
Reference in New Issue
Block a user