Fix type annotations to adhere to latest pyright release

This commit is contained in:
Josh
2022-06-13 05:30:45 +10:00
committed by GitHub
parent 334ef1d7fa
commit c9f777c873
14 changed files with 50 additions and 47 deletions

View File

@ -35,7 +35,7 @@ from .view import StringView
from ._types import BotT
if TYPE_CHECKING:
from typing_extensions import Self, ParamSpec
from typing_extensions import Self, ParamSpec, TypeGuard
from discord.abc import MessageableChannel
from discord.guild import Guild
@ -77,6 +77,10 @@ else:
P = TypeVar('P')
def is_cog(obj: Any) -> TypeGuard[Cog]:
return hasattr(obj, '__cog_commands__')
class DeferTyping:
def __init__(self, ctx: Context[BotT], *, ephemeral: bool):
self.ctx: Context[BotT] = ctx
@ -526,7 +530,7 @@ class Context(discord.abc.Messageable, Generic[BotT]):
await cmd.prepare_help_command(self, entity.qualified_name)
try:
if hasattr(entity, '__cog_commands__'):
if is_cog(entity):
injected = wrap_callback(cmd.send_cog_help)
return await injected(entity)
elif isinstance(entity, Group):