From 54967acfbdd76dcb3549ee87d6fc34abaac1288d Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Thu, 27 Jul 2017 13:56:12 -0500 Subject: [PATCH] Check both guild and channel permissions --- cogs/utils/checks.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cogs/utils/checks.py b/cogs/utils/checks.py index ac040cd..0cf2d24 100644 --- a/cogs/utils/checks.py +++ b/cogs/utils/checks.py @@ -165,9 +165,10 @@ def custom_perms(**perms): return True # Get the member permissions so that we can compare - member_perms = ctx.message.author.guild_permissions + guild_perms = ctx.message.author.guild_permissions + channel_perms = ctx.message.author.permissions_in(ctx.message.channel) # Currently the library doesn't handle administrator overrides..so lets do this manually - if member_perms.administrator: + if guild_perms.administrator: return True # Next, set the default permissions if one is not used, based on what was passed # This will be overriden later, if we have custom permissions @@ -181,7 +182,7 @@ def custom_perms(**perms): required_perm = discord.Permissions(required_perm_value) # Now just check if the person running the command has these permissions - return member_perms >= required_perm + return guild_perms >= required_perm or channel_perms >= required_perm predicate.perms = perms return commands.check(predicate)