mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-09 03:07:00 +00:00
Use typing.Literal for channel and component type annotation
This commit is contained in:
committed by
GitHub
parent
7fca030107
commit
7ee15e1d68
@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Optional, TYPE_CHECKING, Tuple, TypeVar, Union
|
||||
from typing import Callable, Literal, Optional, TYPE_CHECKING, Tuple, TypeVar, Union
|
||||
import inspect
|
||||
import os
|
||||
|
||||
@ -213,7 +213,7 @@ class Button(Item[V]):
|
||||
)
|
||||
|
||||
@property
|
||||
def type(self) -> ComponentType:
|
||||
def type(self) -> Literal[ComponentType.button]:
|
||||
return self._underlying.type
|
||||
|
||||
def to_component_dict(self) -> ButtonComponentPayload:
|
||||
|
@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import List, Optional, TYPE_CHECKING, Tuple, TypeVar, Callable, Union
|
||||
from typing import List, Literal, Optional, TYPE_CHECKING, Tuple, TypeVar, Callable, Union
|
||||
import inspect
|
||||
import os
|
||||
|
||||
@ -288,7 +288,7 @@ class Select(Item[V]):
|
||||
)
|
||||
|
||||
@property
|
||||
def type(self) -> ComponentType:
|
||||
def type(self) -> Literal[ComponentType.select]:
|
||||
return self._underlying.type
|
||||
|
||||
def is_dispatchable(self) -> bool:
|
||||
|
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING, Optional, Tuple, TypeVar
|
||||
from typing import TYPE_CHECKING, Literal, Optional, Tuple, TypeVar
|
||||
|
||||
from ..components import TextInput as TextInputComponent
|
||||
from ..enums import ComponentType, TextStyle
|
||||
@ -231,7 +231,7 @@ class TextInput(Item[V]):
|
||||
)
|
||||
|
||||
@property
|
||||
def type(self) -> ComponentType:
|
||||
def type(self) -> Literal[ComponentType.text_input]:
|
||||
return ComponentType.text_input
|
||||
|
||||
def is_dispatchable(self) -> bool:
|
||||
|
Reference in New Issue
Block a user