Reconcile permission hooks with ctx.permission_state (#2375)

Resolves #2374.

See mod.py's voice mute for an example of why this may be necessary.
This commit is contained in:
Michael H
2019-01-17 22:45:34 -05:00
committed by Toby Harradine
parent 0d4e6a0865
commit 849ade6e58
2 changed files with 17 additions and 1 deletions

View File

@@ -500,7 +500,12 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin):
if result is not None:
hook_results.append(result)
if hook_results:
return all(hook_results)
if all(hook_results):
ctx.permission_state = commands.PermState.ALLOWED_BY_HOOK
return True
else:
ctx.permission_state = commands.PermState.DENIED_BY_HOOK
return False
class Red(RedBase, discord.AutoShardedClient):