diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 896c7ddd3..0c45a51b7 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -989,7 +989,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]): if not asyncio.iscoroutinefunction(coro): raise TypeError('The error handler must be a coroutine.') - self.on_error: Error[Any] = coro + self.on_error: Error[CogT, Any] = coro return coro def has_error_handler(self) -> bool: diff --git a/discord/ext/commands/hybrid.py b/discord/ext/commands/hybrid.py index 641d8185c..9eaf509f0 100644 --- a/discord/ext/commands/hybrid.py +++ b/discord/ext/commands/hybrid.py @@ -233,7 +233,7 @@ class HybridAppCommand(discord.app_commands.Command[CogT, P, T]): del wrapped.callback.__signature__ self.wrapped: Command[CogT, Any, T] = wrapped - self.binding = wrapped.cog + self.binding: Optional[CogT] = wrapped.cog def _copy_with(self, **kwargs) -> Self: copy: Self = super()._copy_with(**kwargs) # type: ignore @@ -383,7 +383,7 @@ class HybridCommand(Command[CogT, P, T]): self, func: CommandCallback[CogT, ContextT, P, T], /, - **kwargs, + **kwargs: Any, ) -> None: super().__init__(func, **kwargs) self.app_command: HybridAppCommand[CogT, Any, T] = HybridAppCommand(self)