diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/decorators.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/bot/decorators.py b/bot/decorators.py index 02cf4b8a..dbaad4a2 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. " @@ -117,7 +117,7 @@ def override_in_channel(func: typing.Callable) -> typing.Callable:      return func -def locked(): +def locked() -> typing.Union[typing.Callable, None]:      """      Allows the user to only run one instance of the decorated command at a time. @@ -125,11 +125,11 @@ def locked():      This decorator has to go before (below) the `command` decorator.      """ -    def wrap(func): +    def wrap(func: typing.Callable) -> typing.Union[typing.Callable, None]:          func.__locks = WeakValueDictionary()          @wraps(func) -        async def inner(self, ctx, *args, **kwargs): +        async def inner(self: typing.Callable, ctx: Context, *args, **kwargs) -> typing.Union[typing.Callable, None]:              lock = func.__locks.setdefault(ctx.author.id, Lock())              if lock.locked():                  embed = Embed() | 
