Fix autocomplete documentation to mention it only passes strings

This commit is contained in:
Rapptz 2022-08-28 02:01:29 -04:00
parent 8ab4d25d40
commit 2e37e47e38

View File

@ -127,8 +127,8 @@ if TYPE_CHECKING:
]
AutocompleteCallback = Union[
Callable[[GroupT, 'Interaction', ChoiceT], Coro[List[Choice[ChoiceT]]]],
Callable[['Interaction', ChoiceT], Coro[List[Choice[ChoiceT]]]],
Callable[[GroupT, 'Interaction', str], Coro[List[Choice[ChoiceT]]]],
Callable[['Interaction', str], Coro[List[Choice[ChoiceT]]]],
]
else:
CommandCallback = Callable[..., Coro[T]]
@ -1041,8 +1041,7 @@ class Command(Generic[GroupT, P, T]):
"""A decorator that registers a coroutine as an autocomplete prompt for a parameter.
The coroutine callback must have 2 parameters, the :class:`~discord.Interaction`,
and the current value by the user (usually either a :class:`str`, :class:`int`, or :class:`float`,
depending on the type of the parameter being marked as autocomplete).
and the current value by the user (the string currently being typed by the user).
To get the values from other parameters that may be filled in, accessing
:attr:`.Interaction.namespace` will give a :class:`Namespace` object with those