discord-interactions.py

from_list

Function

Autocomplete from a list of strings.

from discord_interactions import from_list

Signature

def from_list(    items: List[str],    *,    value_transform: Callable[[str], Any] | None = None,) -> Callable[..., Awaitable[List[Tuple[str, Any]]]]

Parameters

NameTypeDefaultDescription
itemsList[str]required
value_transformCallable[[str], Any] | NoneNone

Returns

Callable[..., Awaitable[List[Tuple[str, Any]]]]

Details

Example:

@slash.command()@autocomplete("color", from_list(["red", "green", "blue"]))async def set_color(ctx, color: str): ...

Type a name: create_button, ModalBuilder, cooldown.