Add initial support for buttons and components

This commit is contained in:
Rapptz
2021-04-25 04:57:29 -04:00
parent f42e922696
commit 98570793e4
17 changed files with 1195 additions and 14 deletions

View File

@ -48,6 +48,8 @@ __all__ = (
'StickerType',
'InviteTarget',
'VideoQualityMode',
'ComponentType',
'ButtonStyle',
)
def _create_value_cls(name):
@ -435,6 +437,15 @@ class InviteTarget(Enum):
class InteractionType(Enum):
ping = 1
application_command = 2
component = 3
class InteractionResponseType(Enum):
pong = 1
# ack = 2 (deprecated)
# channel_message = 3 (deprecated)
channel_message = 4 # (with source)
deferred_channel_message = 5 # (with source)
ack = 6 # for components?
class VideoQualityMode(Enum):
auto = 1
@ -443,6 +454,23 @@ class VideoQualityMode(Enum):
def __int__(self):
return self.value
class ComponentType(Enum):
group = 1
button = 2
def __int__(self):
return self.value
class ButtonStyle(Enum):
blurple = 1
grey = 2
green = 3
red = 4
hyperlink = 5
def __int__(self):
return self.value
T = TypeVar('T')
def create_unknown_value(cls: Type[T], val: Any) -> T: