diff options
author | 2019-10-02 16:34:19 -0400 | |
---|---|---|
committer | 2019-10-02 16:34:19 -0400 | |
commit | 5b0a5788c1bf7beeff709746848b458ea7b52b4e (patch) | |
tree | 1c8ee9fd44ad6001d8fab2a570902810a4b533c4 /bot/decorators.py | |
parent | Merge pull request #285 from Numerlor/hacktober-date-channel-fixes (diff) | |
parent | adjust end date time to the end of the last day of october instead of the beg... (diff) |
Merge pull request #289 from Numerlor/channel_override_role_bypass_fix
Put role bypass check above channel override check
Diffstat (limited to 'bot/decorators.py')
-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 2c042b56..58f67a15 100644 --- a/bot/decorators.py +++ b/bot/decorators.py @@ -81,6 +81,13 @@ def in_channel_check(*channels: int, bypass_roles: typing.Container[int] = None) ) return True + if bypass_roles and any(r.id in bypass_roles for r in ctx.author.roles): + log.debug( + f"{ctx.author} called the '{ctx.command.name}' command and " + f"had a role to bypass the in_channel check." + ) + return True + if hasattr(ctx.command.callback, "in_channel_override"): override = ctx.command.callback.in_channel_override if override is None: @@ -106,13 +113,6 @@ def in_channel_check(*channels: int, bypass_roles: typing.Container[int] = None) f"Sorry, but you may only use this command within {channels_str}." ) - if bypass_roles and any(r.id in bypass_roles for r in ctx.author.roles): - log.debug( - f"{ctx.author} called the '{ctx.command.name}' command and " - f"had a role to bypass the in_channel check." - ) - return True - log.debug( f"{ctx.author} tried to call the '{ctx.command.name}' command. " f"The in_channel check failed." |