Skip to content

Commit 5434e75

Browse files
authored
feat: SlashCommandChoice as parameter for AutoCompleteContext.send (#1380)
* Update context.py * Update context.py
1 parent 8c5cf71 commit 5434e75

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

interactions/models/internal/context.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from interactions.models.internal.application_commands import (
3737
OptionType,
3838
CallbackType,
39+
SlashCommandChoice,
3940
SlashCommandOption,
4041
InteractionCommand,
4142
)
@@ -862,7 +863,9 @@ def option_processing_hook(self, option: dict) -> None:
862863
self.focussed_option = SlashCommandOption.from_dict(option)
863864
return
864865

865-
async def send(self, choices: typing.Iterable[str | int | float | dict[str, int | float | str]]) -> None:
866+
async def send(
867+
self, choices: typing.Iterable[str | int | float | dict[str, int | float | str] | SlashCommandChoice]
868+
) -> None:
866869
"""
867870
Send your autocomplete choices to discord. Choices must be either a list of strings, or a dictionary following the following format:
868871
@@ -892,6 +895,9 @@ async def send(self, choices: typing.Iterable[str | int | float | dict[str, int
892895
if isinstance(choice, dict):
893896
name = choice["name"]
894897
value = choice["value"]
898+
elif isinstance(choice, SlashCommandChoice):
899+
name = choice.name
900+
value = choice.value
895901
else:
896902
name = str(choice)
897903
value = choice

0 commit comments

Comments
 (0)