Browse Source

Correct app command decorators that use Interaction

pull/9193/head
Trevor 2 years ago
committed by GitHub
parent
commit
2e737e70de
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      discord/app_commands/checks.py
  2. 22
      discord/app_commands/commands.py

4
discord/app_commands/checks.py

@ -59,8 +59,8 @@ if TYPE_CHECKING:
from ..interactions import Interaction
CooldownFunction = Union[
Callable[[Interaction], Coroutine[Any, Any, T]],
Callable[[Interaction], T],
Callable[[Interaction[Any]], Coroutine[Any, Any, T]],
Callable[[Interaction[Any]], T],
]
__all__ = (

22
discord/app_commands/commands.py

@ -99,19 +99,19 @@ T = TypeVar('T')
F = TypeVar('F', bound=Callable[..., Any])
GroupT = TypeVar('GroupT', bound='Binding')
Coro = Coroutine[Any, Any, T]
UnboundError = Callable[['Interaction', AppCommandError], Coro[Any]]
UnboundError = Callable[['Interaction[Any]', AppCommandError], Coro[Any]]
Error = Union[
Callable[[GroupT, 'Interaction', AppCommandError], Coro[Any]],
Callable[[GroupT, 'Interaction[Any]', AppCommandError], Coro[Any]],
UnboundError,
]
Check = Callable[['Interaction'], Union[bool, Coro[bool]]]
Check = Callable[['Interaction[Any]'], Union[bool, Coro[bool]]]
Binding = Union['Group', 'commands.Cog']
if TYPE_CHECKING:
CommandCallback = Union[
Callable[Concatenate[GroupT, 'Interaction', P], Coro[T]],
Callable[Concatenate['Interaction', P], Coro[T]],
Callable[Concatenate[GroupT, 'Interaction[Any]', P], Coro[T]],
Callable[Concatenate['Interaction[Any]', P], Coro[T]],
]
ContextMenuCallback = Union[
@ -120,15 +120,15 @@ if TYPE_CHECKING:
# Callable[[GroupT, 'Interaction', User], Coro[Any]],
# Callable[[GroupT, 'Interaction', Message], Coro[Any]],
# Callable[[GroupT, 'Interaction', Union[Member, User]], Coro[Any]],
Callable[['Interaction', Member], Coro[Any]],
Callable[['Interaction', User], Coro[Any]],
Callable[['Interaction', Message], Coro[Any]],
Callable[['Interaction', Union[Member, User]], Coro[Any]],
Callable[['Interaction[Any]', Member], Coro[Any]],
Callable[['Interaction[Any]', User], Coro[Any]],
Callable[['Interaction[Any]', Message], Coro[Any]],
Callable[['Interaction[Any]', Union[Member, User]], Coro[Any]],
]
AutocompleteCallback = Union[
Callable[[GroupT, 'Interaction', str], Coro[List[Choice[ChoiceT]]]],
Callable[['Interaction', str], Coro[List[Choice[ChoiceT]]]],
Callable[[GroupT, 'Interaction[Any]', str], Coro[List[Choice[ChoiceT]]]],
Callable[['Interaction[Any]', str], Coro[List[Choice[ChoiceT]]]],
]
else:
CommandCallback = Callable[..., Coro[T]]

Loading…
Cancel
Save