Apparently, there seems to be a bug with the latest commit including the new autocomplete helpers.
An simple example of code that invoked this issue:
async def example_autocomplete(
ctx: tanjun.abc.AutocompleteContext,
) -> None:
await ctx.set_choices({"Choice": "Value"})
@component.with_command
@tanchi.as_slash_command()
async def autocomplete_bug(
ctx: tanjun.abc.SlashContext,
param: tanchi.Autocompleted[example_autocomplete],
) -> None:
...
E 2022-05-10 19:10:12,444 hikari.event_manager: an exception occurred handling an event (InteractionCreateEvent)
Traceback (most recent call last):
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\tanjun\clients.py", line 2641, in on_interaction_create_event
return await self.on_gateway_autocomplete_create(event.interaction)
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\tanjun\clients.py", line 2560, in on_gateway_autocomplete_create
await coro
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\tanjun\commands\slash.py", line 2432, in execute_autocomplete
await ctx.call_with_async_di(callback, ctx, ctx.focused.value)
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\alluka\_client.py", line 317, in call_with_async_di
return await self._injection_client.call_with_ctx_async(self, callback, *args, **kwargs)
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\alluka\_client.py", line 236, in call_with_ctx_async
return typing.cast(_T, await result)
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\tanchi\autocompletion.py", line 26, in wrapper
await context.set_choices(result) # type: ignore # choices have to have the same type
File "C:\Users\_\Documents\_\_\staging\_-hikari\venv\lib\site-packages\tanjun\context\autocomplete.py", line 218, in set_choices
choices = dict(choices, **kwargs)
TypeError: 'coroutine' object is not iterable
I have also checked and made sure that d25f99689431f79018aae2e0c8443a7856e844af was the sole commit that caused this problem as older versions work fine.