Skip to content

Commit bb3b6b3

Browse files
fractal13eightween
authored andcommitted
Bug fix for calling autocomplete as method of Client subclass. Issue #1582
1 parent 5c5c9f9 commit bb3b6b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

interactions/client/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,12 @@ async def _dispatch_interaction(self, event: RawGatewayEvent) -> None: # noqa:
18071807

18081808
if auto_opt := getattr(ctx, "focussed_option", None):
18091809
if autocomplete := ctx.command.autocomplete_callbacks.get(str(auto_opt.name)):
1810-
callback = autocomplete
1810+
if ctx.command.has_binding:
1811+
callback = CallbackObject()
1812+
callback.callback = autocomplete
1813+
callback._binding = ctx.command._binding
1814+
else:
1815+
callback = autocomplete
18111816
elif autocomplete := self._global_autocompletes.get(str(auto_opt.name)):
18121817
callback = autocomplete
18131818
else:

0 commit comments

Comments
 (0)