aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2018-10-20 18:08:28 +0000
committerGravatar Leon Sandøy <[email protected]>2018-10-20 18:08:28 +0000
commitb8de191483ac0e4058d189989acd73c2b239c0a3 (patch)
treea4f0b949e69afb17d0e5c4cdb519079f19f47c83
parentWolfram Cog - Merge Request 56, by Chibli (diff)
parentChange BYPASS_ROLES check from top_role to all roles. (diff)
Merge branch 'eval-role-bypass-fix' into 'master'
Change BYPASS_ROLES check from top_role to all roles. See merge request python-discord/projects/bot!78
-rw-r--r--bot/cogs/snekbox.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py
index fb9164194..2e52b8d1b 100644
--- a/bot/cogs/snekbox.py
+++ b/bot/cogs/snekbox.py
@@ -60,10 +60,11 @@ async def channel_is_whitelisted_or_author_can_bypass(ctx: Context):
or the channel is a whitelisted channel.
"""
- if ctx.channel.id not in WHITELISTED_CHANNELS and ctx.author.top_role.id not in BYPASS_ROLES:
- raise MissingPermissions("You are not allowed to do that here.")
-
- return True
+ if ctx.channel.id in WHITELISTED_CHANNELS:
+ return True
+ if any(r.id in BYPASS_ROLES for r in ctx.author.roles):
+ return True
+ raise MissingPermissions("You are not allowed to do that here.")
class Snekbox: