diff options
| author | 2020-07-17 10:01:56 -0700 | |
|---|---|---|
| committer | 2020-07-31 22:58:05 -0700 | |
| commit | b3e1ebfb7a8d9a31bbd5eba1a14c1c132590ee86 (patch) | |
| tree | 0929823f4026c85b2feafd649241ae2e0d07fd87 | |
| parent | Reminders: fix reminder_id type annotation (diff) | |
Decorators: more accurate return type for checks
| -rw-r--r-- | bot/decorators.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/decorators.py b/bot/decorators.py index 500197c89..b9182f664 100644 --- a/bot/decorators.py +++ b/bot/decorators.py @@ -24,7 +24,7 @@ def in_whitelist( roles: Container[int] = (), redirect: Optional[int] = Channels.bot_commands, fail_silently: bool = False, -) -> Callable: +) -> commands.Command: """ Check if a command was issued in a whitelisted context. @@ -45,7 +45,7 @@ def in_whitelist( return commands.check(predicate) -def with_role(*role_ids: int) -> Callable: +def with_role(*role_ids: int) -> commands.Command: """Returns True if the user has any one of the roles in role_ids.""" async def predicate(ctx: Context) -> bool: """With role checker predicate.""" @@ -53,7 +53,7 @@ def with_role(*role_ids: int) -> Callable: return commands.check(predicate) -def without_role(*role_ids: int) -> Callable: +def without_role(*role_ids: int) -> commands.Command: """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) |