Skip to content

Commit 3b45179

Browse files
committed
fix: 🐛 Async staticmethod autocompletes are not awaited (Pycord-Development#2966)
* :fix: Async staticmethod autocompletes not awaited * 📝 CHANGELOG.md (cherry picked from commit aef54eb)
1 parent 10e875d commit 3b45179

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ These changes are available on the `master` branch, but have not yet been releas
5959
([#2938](https://github.com/Pycord-Development/pycord/pull/2938))
6060
- Fixed `TypeError` when using Python 3.12+ `type` syntax for typing slash command
6161
parameters. ([#2952](https://github.com/Pycord-Development/pycord/pull/2952))
62+
- Fixed autocomplete crashing when using an async staticmethod.
63+
([#2966](https://github.com/Pycord-Development/pycord/pull/2966))
6264

6365
### Removed
6466

discord/commands/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ async def invoke_autocomplete_callback(self, ctx: AutocompleteContext):
10591059
else:
10601060
result = option.autocomplete(ctx)
10611061

1062-
if asyncio.iscoroutinefunction(option.autocomplete):
1062+
if inspect.isawaitable(result):
10631063
result = await result
10641064

10651065
choices = [o if isinstance(o, OptionChoice) else OptionChoice(o) for o in result][:25]

0 commit comments

Comments
 (0)