@@ -90,7 +90,9 @@ def get_signature_parameters(
9090 required_params = twitchio .utils .is_inside_class (function ) + 1 if skip_parameters is None else skip_parameters
9191
9292 if len (signature .parameters ) < required_params :
93- raise TypeError (f"Command signature requires at least { required_params - 1 } parameter(s)" )
93+ raise TypeError (
94+ f"Command signature for { function .__name__ !r} is missing { required_params - 1 } required parameter(s)"
95+ )
9496
9597 iterator = iter (signature .parameters .items ())
9698 for _ in range (0 , required_params ):
@@ -164,9 +166,9 @@ def __repr__(self) -> str:
164166 def __str__ (self ) -> str :
165167 return self ._name
166168
167- async def __call__ (self , context : Context ) -> None :
169+ async def __call__ (self , context : Context ) -> Any :
168170 callback = self ._callback (self ._injected , context ) if self ._injected else self ._callback (context ) # type: ignore
169- await callback
171+ return await callback
170172
171173 @property
172174 def component (self ) -> Component_T | None :
@@ -468,7 +470,7 @@ async def _run_cooldowns(self, context: Context) -> None:
468470 cooldown = cooldown ,
469471 )
470472
471- async def _invoke (self , context : Context ) -> None :
473+ async def _invoke (self , context : Context ) -> Any :
472474 context ._component = self ._injected
473475
474476 if not self ._guards_after_parsing :
@@ -505,13 +507,13 @@ async def _invoke(self, context: Context) -> None:
505507 callback = self ._callback (* args , ** kwargs ) # type: ignore
506508
507509 try :
508- await callback
510+ return await callback
509511 except Exception as e :
510512 raise CommandInvokeError (msg = str (e ), original = e ) from e
511513
512- async def invoke (self , context : Context ) -> None :
514+ async def invoke (self , context : Context ) -> Any :
513515 try :
514- await self ._invoke (context )
516+ return await self ._invoke (context )
515517 except CommandError as e :
516518 await self ._dispatch_error (context , e )
517519 except Exception as e :
@@ -861,7 +863,7 @@ async def _invoke(self, context: Context) -> None:
861863
862864 if not trigger or (not next_ and self ._invoke_fallback ):
863865 view .undo ()
864- await super ()._invoke (context = context )
866+ return await super ()._invoke (context = context )
865867
866868 elif next_ :
867869 if self ._apply_cooldowns :
@@ -870,14 +872,13 @@ async def _invoke(self, context: Context) -> None:
870872 if self ._apply_guards :
871873 await super ()._run_guards (context , with_cooldowns = False )
872874
873- await next_ .invoke (context = context )
875+ return await next_ .invoke (context = context )
874876
875- else :
876- raise CommandNotFound (f'The sub-command "{ trigger } " for group "{ self ._name } " was not found.' )
877+ raise CommandNotFound (f'The sub-command "{ trigger } " for group "{ self ._name } " was not found.' )
877878
878879 async def invoke (self , context : Context ) -> None :
879880 try :
880- await self ._invoke (context )
881+ return await self ._invoke (context )
881882 except CommandError as e :
882883 await self ._dispatch_error (context , e )
883884
0 commit comments