diff options
| author | 2020-08-01 08:54:42 -0700 | |
|---|---|---|
| committer | 2020-08-01 08:54:42 -0700 | |
| commit | 675d9a2abf7212f4680d124c72da1a914c87756c (patch) | |
| tree | 1ffb24519773b15952458a98bed777f67c02ad33 | |
| parent | Reminders: use singular form for mutually exclusive namespace (diff) | |
Decorators: fix type annotations for checks
The annotation was previously changed on the basis of an incorrect
return annotation PyCharm inferred for `check()`.
| -rw-r--r-- | bot/decorators.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/decorators.py b/bot/decorators.py index 15386e506..96f0d1408 100644 --- a/bot/decorators.py +++ b/bot/decorators.py @@ -9,7 +9,7 @@ from functools import partial, wraps from weakref import WeakValueDictionary from discord import Colour, Embed, Member, NotFound -from discord.ext.commands import Cog, Command, Context, check +from discord.ext.commands import Cog, Context, check from bot.constants import Channels, ERROR_REPLIES, RedirectOutput from bot.errors import LockedResourceError @@ -31,7 +31,7 @@ def in_whitelist( roles: t.Container[int] = (), redirect: t.Optional[int] = Channels.bot_commands, fail_silently: bool = False, -) -> Command: +) -> t.Callable: """ Check if a command was issued in a whitelisted context. @@ -52,7 +52,7 @@ def in_whitelist( return check(predicate) -def with_role(*role_ids: int) -> Command: +def with_role(*role_ids: int) -> t.Callable: """Returns True if the user has any one of the roles in role_ids.""" async def predicate(ctx: Context) -> bool: """With role checker predicate.""" @@ -60,7 +60,7 @@ def with_role(*role_ids: int) -> Command: return check(predicate) -def without_role(*role_ids: int) -> Command: +def without_role(*role_ids: int) -> t.Callable: """Returns True if the user does not have any of the roles in role_ids.""" async def predicate(ctx: Context) -> bool: return without_role_check(ctx, *role_ids) |