Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Autocomplete bug in latest commit version #2

Closed
GoogleGenius opened this issue May 11, 2022 · 4 comments
Closed

Autocomplete bug in latest commit version #2

GoogleGenius opened this issue May 11, 2022 · 4 comments

Comments

@GoogleGenius
Copy link
Contributor

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 d25f996 was the sole commit that caused this problem as older versions work fine.

@GoogleGenius GoogleGenius changed the title Autocomplete bug in commit d25f99689431f79018aae2e0c8443a7856e844af Autocomplete bug in latest commit version May 11, 2022
@thesadru
Copy link
Owner

Oh damn, that is not ideal. I will roll out a fix ASAP.

Did I release this version to pypi or is it only on master?

@GoogleGenius
Copy link
Contributor Author

It's only on master, fortunately.

@thesadru
Copy link
Owner

Should hopefully be fixed with 705bec8

@GoogleGenius
Copy link
Contributor Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants