aboutsummaryrefslogtreecommitdiff
path: root/discord/ui/button.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-26 21:34:01 -0400
committerRapptz <[email protected]>2021-05-27 00:53:14 -0400
commited9badcddfc04270963dfe488132e93422d54c0c (patch)
tree1b0d1f99c097d3fe40e8556980e69f75d55c1d90 /discord/ui/button.py
parentChange the way callbacks are defined to allow deriving (diff)
downloaddiscord.py-ed9badcddfc04270963dfe488132e93422d54c0c.tar.xz
discord.py-ed9badcddfc04270963dfe488132e93422d54c0c.zip
Make Item and Button generic over the underlying view
Diffstat (limited to 'discord/ui/button.py')
-rw-r--r--discord/ui/button.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/discord/ui/button.py b/discord/ui/button.py
index 8ff4ce74..0d156a96 100644
--- a/discord/ui/button.py
+++ b/discord/ui/button.py
@@ -41,7 +41,7 @@ __all__ = (
)
if TYPE_CHECKING:
- from ..components import Component
+ from .view import View
_custom_emoji = re.compile(r'<?(?P<animated>a)?:?(?P<name>[A-Za-z0-9\_]+):(?P<id>[0-9]{13,20})>?')
@@ -63,9 +63,10 @@ def _to_partial_emoji(obj: Union[str, PartialEmoji], *, _custom_emoji=_custom_em
B = TypeVar('B', bound='Button')
+V = TypeVar('V', bound='View', covariant=True)
-class Button(Item):
+class Button(Item[V]):
"""Represents a UI button.
.. versionadded:: 2.0