Skip to content

[BUG] If an autocomplete function is a method of a Client subclass, the object binding is missing. #1582

Closed
@fractal13

Description

@fractal13

Library Version

5.11.0

Describe the Bug

Autocomplete functions implemented as methods of a Client subclass are not called with binding to the client object. This causes the autocomplete call to raise an exception.

Steps to Reproduce

The attached bot will demonstrate the failure when the user tries to issue the command: /ichart c4
autocomplete-failure.zip

Expected Results

I would expect to have a method of the Client class be usable as an autocomplete routine.

Minimal Reproducible Code

I'm sorry it's so long, but please see the attached bot in the Steps to Reproduce.

Traceback

$ ./bot6-autocomplete-fails.py
This bot is owned by @fractal13
Task exception was never retrieved
future: <Task finished name='Task-56' coro=<Client._dispatch_interaction() done, defined at /home/cgl/repos/interactions.py/interactions/client/client.py:1773> exception=TypeError("MyBot.chart_c4_integer_autocomplete() missing 1 required positional argument: 'ctx'")>
Traceback (most recent call last):
File "/home/cgl/repos/interactions.py/interactions/client/client.py", line 1818, in _dispatch_interaction
callback=callback(ctx),
TypeError: MyBot.chart_c4_integer_autocomplete() missing 1 required positional argument: 'ctx'

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.
  • I have attempted to debug this myself, and I believe this issue is with the library

Additional Information

I have a PR that fixes this issue. There may be a better way to fix it. Please feel free to use your own solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem rightquestionFurther information is requestedspecific conditionThis happens on specific condition

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions