aboutsummaryrefslogtreecommitdiffstats
path: root/bot/decorators.py
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2019-09-09 13:22:09 -0400
committerGravatar S. Co1 <[email protected]>2019-09-09 15:00:38 -0400
commitbd03db75805d02da2088ec5067993aa5f23184ae (patch)
tree4038157164a5d4eaf918870ed3063eda22421816 /bot/decorators.py
parentAdd flake8-annotations to dev dependencies (diff)
Initial linting pass
Bot root, seasons cog, easter cogs, evergreen cogs, halloween cogs
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()