aboutsummaryrefslogtreecommitdiffstats
path: root/bot/decorators.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/decorators.py')
-rw-r--r--bot/decorators.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bot/decorators.py b/bot/decorators.py
index 02cf4b8a..e12c3f34 100644
--- a/bot/decorators.py
+++ b/bot/decorators.py
@@ -20,9 +20,9 @@ class InChannelCheckFailure(CheckFailure):
pass
-def with_role(*role_ids: int):
+def with_role(*role_ids: int) -> bool:
"""Check to see whether the invoking user has any of the roles specified in role_ids."""
- async def predicate(ctx: Context):
+ async def predicate(ctx: Context) -> bool:
if not ctx.guild: # Return False in a DM
log.debug(
f"{ctx.author} tried to use the '{ctx.command.name}'command from a DM. "
@@ -43,9 +43,9 @@ def with_role(*role_ids: int):
return commands.check(predicate)
-def without_role(*role_ids: int):
+def without_role(*role_ids: int) -> bool:
"""Check whether the invoking user does not have all of the roles specified in role_ids."""
- async def predicate(ctx: Context):
+ async def predicate(ctx: Context) -> bool:
if not ctx.guild: # Return False in a DM
log.debug(
f"{ctx.author} tried to use the '{ctx.command.name}' command from a DM. "
@@ -125,11 +125,11 @@ def locked():
This decorator has to go before (below) the `command` decorator.
"""
- def wrap(func):
+ def wrap(func: typing.Callable):
func.__locks = WeakValueDictionary()
@wraps(func)
- async def inner(self, ctx, *args, **kwargs):
+ async def inner(self, ctx: Context, *args, **kwargs):
lock = func.__locks.setdefault(ctx.author.id, Lock())
if lock.locked():
embed = Embed()