Add a permission to !ghwebhook so an admin user can use it without +o (github)

This commit is contained in:
jesopo 2019-01-29 08:06:59 +00:00
parent 0564a173a3
commit 5d47e7e895
2 changed files with 9 additions and 10 deletions

View file

@ -173,23 +173,21 @@ class Module(ModuleManager.BaseModule):
hook=hook, user=event["user"], server=event["server"], hook=hook, user=event["user"], server=event["server"],
target=target, is_channel=is_channel, tags=event["tags"]) target=target, is_channel=is_channel, tags=event["tags"])
error = None hard_fail = False
force_success = False force_success = False
error = None
for returned in returns: for returned in returns:
if returned == utils.consts.PERMISSION_HARD_FAIL: if returned == utils.consts.PERMISSION_HARD_FAIL:
# denotes a "silent failure" hard_fail = True
target.buffer.skip_next()
return
elif returned == utils.consts.PERMISSION_FORCE_SUCCESS: elif returned == utils.consts.PERMISSION_FORCE_SUCCESS:
force_success = True force_success = True
break
elif returned: elif returned:
# error message
error = returned error = returned
if error and not force_success:
stderr.write(error).send(command_method) if hard_fail or (not force_success and error):
target.buffer.skip_next() if error:
return stderr.write(error).send(command_method)
target.buffer.skip_next()
if hook.kwargs.get("remove_empty", True): if hook.kwargs.get("remove_empty", True):
args_split = list(filter(None, args_split)) args_split = list(filter(None, args_split))

View file

@ -157,6 +157,7 @@ class Module(ModuleManager.BaseModule):
""" """
:help: Add/remove/modify a github webhook :help: Add/remove/modify a github webhook
:require_mode: high :require_mode: high
:permission: githuboverride
:usage: list :usage: list
:usage: add <hook> :usage: add <hook>
:usage: remove <hook> :usage: remove <hook>