mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-01-15 18:51:41 +00:00
[commands] Mark Cog check special methods as MaybeCoro return
Fix #10354
This commit is contained in:
@@ -47,7 +47,7 @@ from typing import (
|
|||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ._types import _BaseCommand, BotT
|
from ._types import _BaseCommand, BotT, MaybeCoro
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
@@ -583,7 +583,7 @@ class Cog(metaclass=CogMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@_cog_special_method
|
@_cog_special_method
|
||||||
def bot_check_once(self, ctx: Context[BotT]) -> bool:
|
def bot_check_once(self, ctx: Context[BotT]) -> MaybeCoro[bool]:
|
||||||
"""A special method that registers as a :meth:`.Bot.check_once`
|
"""A special method that registers as a :meth:`.Bot.check_once`
|
||||||
check.
|
check.
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ class Cog(metaclass=CogMeta):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
@_cog_special_method
|
@_cog_special_method
|
||||||
def bot_check(self, ctx: Context[BotT]) -> bool:
|
def bot_check(self, ctx: Context[BotT]) -> MaybeCoro[bool]:
|
||||||
"""A special method that registers as a :meth:`.Bot.check`
|
"""A special method that registers as a :meth:`.Bot.check`
|
||||||
check.
|
check.
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ class Cog(metaclass=CogMeta):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
@_cog_special_method
|
@_cog_special_method
|
||||||
def cog_check(self, ctx: Context[BotT]) -> bool:
|
def cog_check(self, ctx: Context[BotT]) -> MaybeCoro[bool]:
|
||||||
"""A special method that registers as a :func:`~discord.ext.commands.check`
|
"""A special method that registers as a :func:`~discord.ext.commands.check`
|
||||||
for every command and subcommand in this cog.
|
for every command and subcommand in this cog.
|
||||||
|
|
||||||
@@ -613,7 +613,7 @@ class Cog(metaclass=CogMeta):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
@_cog_special_method
|
@_cog_special_method
|
||||||
def interaction_check(self, interaction: discord.Interaction[ClientT], /) -> bool:
|
def interaction_check(self, interaction: discord.Interaction[ClientT], /) -> MaybeCoro[bool]:
|
||||||
"""A special method that registers as a :func:`discord.app_commands.check`
|
"""A special method that registers as a :func:`discord.app_commands.check`
|
||||||
for every app command and subcommand in this cog.
|
for every app command and subcommand in this cog.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user