@@ -503,7 +503,7 @@ def error(self, coro):
503
503
The coroutine passed is not actually a coroutine.
504
504
"""
505
505
506
- if not asyncio .iscoroutinefunction (coro ):
506
+ if not inspect .iscoroutinefunction (coro ):
507
507
raise TypeError ("The error handler must be a coroutine." )
508
508
509
509
self .on_error = coro
@@ -532,7 +532,7 @@ def before_invoke(self, coro):
532
532
TypeError
533
533
The coroutine passed is not actually a coroutine.
534
534
"""
535
- if not asyncio .iscoroutinefunction (coro ):
535
+ if not inspect .iscoroutinefunction (coro ):
536
536
raise TypeError ("The pre-invoke hook must be a coroutine." )
537
537
538
538
self ._before_invoke = coro
@@ -557,7 +557,7 @@ def after_invoke(self, coro):
557
557
TypeError
558
558
The coroutine passed is not actually a coroutine.
559
559
"""
560
- if not asyncio .iscoroutinefunction (coro ):
560
+ if not inspect .iscoroutinefunction (coro ):
561
561
raise TypeError ("The post-invoke hook must be a coroutine." )
562
562
563
563
self ._after_invoke = coro
@@ -734,7 +734,7 @@ def __new__(cls, *args, **kwargs) -> SlashCommand:
734
734
735
735
def __init__ (self , func : Callable , * args , ** kwargs ) -> None :
736
736
super ().__init__ (func , ** kwargs )
737
- if not asyncio .iscoroutinefunction (func ):
737
+ if not inspect .iscoroutinefunction (func ):
738
738
raise TypeError ("Callback must be a coroutine." )
739
739
self .callback = func
740
740
@@ -1125,7 +1125,7 @@ async def invoke_autocomplete_callback(self, ctx: AutocompleteContext):
1125
1125
else :
1126
1126
result = option .autocomplete (ctx )
1127
1127
1128
- if asyncio .iscoroutinefunction (option .autocomplete ):
1128
+ if inspect .iscoroutinefunction (option .autocomplete ):
1129
1129
result = await result
1130
1130
1131
1131
choices = [
@@ -1653,7 +1653,7 @@ def __new__(cls, *args, **kwargs) -> ContextMenuCommand:
1653
1653
1654
1654
def __init__ (self , func : Callable , * args , ** kwargs ) -> None :
1655
1655
super ().__init__ (func , ** kwargs )
1656
- if not asyncio .iscoroutinefunction (func ):
1656
+ if not inspect .iscoroutinefunction (func ):
1657
1657
raise TypeError ("Callback must be a coroutine." )
1658
1658
self .callback = func
1659
1659
0 commit comments