mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
[commands] Fix typing of check/check_any
This changes the type information of check decorators to return a protocol representing that the decorator leaves the underlying object unchanged while having a .predicate attribute. resolves #7949
This commit is contained in:
@ -60,7 +60,7 @@ if TYPE_CHECKING:
|
||||
from .parameters import Parameter
|
||||
|
||||
from ._types import (
|
||||
Check,
|
||||
UserCheck,
|
||||
ContextT,
|
||||
BotT,
|
||||
_Bot,
|
||||
@ -378,7 +378,7 @@ class HelpCommand:
|
||||
bot.remove_command(self._command_impl.name)
|
||||
self._command_impl._eject_cog()
|
||||
|
||||
def add_check(self, func: Check[ContextT], /) -> None:
|
||||
def add_check(self, func: UserCheck[ContextT], /) -> None:
|
||||
"""
|
||||
Adds a check to the help command.
|
||||
|
||||
@ -396,7 +396,7 @@ class HelpCommand:
|
||||
|
||||
self._command_impl.add_check(func)
|
||||
|
||||
def remove_check(self, func: Check[ContextT], /) -> None:
|
||||
def remove_check(self, func: UserCheck[ContextT], /) -> None:
|
||||
"""
|
||||
Removes a check from the help command.
|
||||
|
||||
|
Reference in New Issue
Block a user