mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-17 03:09:05 +00:00
[commands] Use ...
for Command
and Group
typing
This commit is contained in:
parent
82bfb3cf34
commit
0ea098567c
@ -1161,9 +1161,9 @@ class Client:
|
|||||||
event: Literal['app_command_completion'],
|
event: Literal['app_command_completion'],
|
||||||
/,
|
/,
|
||||||
*,
|
*,
|
||||||
check: Optional[Callable[[Interaction[Self], Union[Command[Any, Any, Any], ContextMenu]], bool]],
|
check: Optional[Callable[[Interaction[Self], Union[Command[Any, ..., Any], ContextMenu]], bool]],
|
||||||
timeout: Optional[float] = None,
|
timeout: Optional[float] = None,
|
||||||
) -> Tuple[Interaction[Self], Union[Command[Any, Any, Any], ContextMenu]]:
|
) -> Tuple[Interaction[Self], Union[Command[Any, ..., Any], ContextMenu]]:
|
||||||
...
|
...
|
||||||
|
|
||||||
# AutoMod
|
# AutoMod
|
||||||
|
@ -72,9 +72,9 @@ __all__ = (
|
|||||||
T = TypeVar('T')
|
T = TypeVar('T')
|
||||||
U = TypeVar('U')
|
U = TypeVar('U')
|
||||||
CogT = TypeVar('CogT', bound='Cog')
|
CogT = TypeVar('CogT', bound='Cog')
|
||||||
CommandT = TypeVar('CommandT', bound='Command[Any, Any, Any]')
|
CommandT = TypeVar('CommandT', bound='Command[Any, ..., Any]')
|
||||||
# CHT = TypeVar('CHT', bound='Check')
|
# CHT = TypeVar('CHT', bound='Check')
|
||||||
GroupT = TypeVar('GroupT', bound='Group[Any, Any, Any]')
|
GroupT = TypeVar('GroupT', bound='Group[Any, ..., Any]')
|
||||||
_NoneType = type(None)
|
_NoneType = type(None)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -297,7 +297,7 @@ def replace_parameters(
|
|||||||
|
|
||||||
|
|
||||||
class HybridAppCommand(discord.app_commands.Command[CogT, P, T]):
|
class HybridAppCommand(discord.app_commands.Command[CogT, P, T]):
|
||||||
def __init__(self, wrapped: Union[HybridCommand[CogT, Any, T], HybridGroup[CogT, Any, T]]) -> None:
|
def __init__(self, wrapped: Union[HybridCommand[CogT, ..., T], HybridGroup[CogT, ..., T]]) -> None:
|
||||||
signature = inspect.signature(wrapped.callback)
|
signature = inspect.signature(wrapped.callback)
|
||||||
params = replace_parameters(wrapped.params, wrapped.callback, signature)
|
params = replace_parameters(wrapped.params, wrapped.callback, signature)
|
||||||
wrapped.callback.__signature__ = signature.replace(parameters=params)
|
wrapped.callback.__signature__ = signature.replace(parameters=params)
|
||||||
@ -312,7 +312,7 @@ class HybridAppCommand(discord.app_commands.Command[CogT, P, T]):
|
|||||||
finally:
|
finally:
|
||||||
del wrapped.callback.__signature__
|
del wrapped.callback.__signature__
|
||||||
|
|
||||||
self.wrapped: Union[HybridCommand[CogT, Any, T], HybridGroup[CogT, Any, T]] = wrapped
|
self.wrapped: Union[HybridCommand[CogT, ..., T], HybridGroup[CogT, ..., T]] = wrapped
|
||||||
self.binding: Optional[CogT] = wrapped.cog
|
self.binding: Optional[CogT] = wrapped.cog
|
||||||
# This technically means only one flag converter is supported
|
# This technically means only one flag converter is supported
|
||||||
self.flag_converter: Optional[Tuple[str, Type[FlagConverter]]] = getattr(
|
self.flag_converter: Optional[Tuple[str, Type[FlagConverter]]] = getattr(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user