allow !part to work for "current channel" when op/!access

This commit is contained in:
jesopo 2020-01-13 16:32:45 +00:00
parent 7ede930f67
commit 21694c39a5

View file

@ -33,18 +33,22 @@ class Module(ModuleManager.BaseModule):
event["stderr"].write("Line was filtered") event["stderr"].write("Line was filtered")
@utils.hook("received.command.part") @utils.hook("received.command.part")
@utils.kwarg("help", "Part from the current or given channel")
@utils.kwarg("usage", "[channel]")
def part(self, event): def part(self, event):
""" check = utils.Check("permission", "part")
:help: Part from the current or given channel
:usage: [channel]
:permission: part
"""
if event["args"]: if event["args"]:
target = event["args_split"][0] target = event["args_split"][0]
elif event["is_channel"]: elif event["is_channel"]:
target = event["target"].name target = event["target"].name
check |= utils.Check("channel-mode", "high")
check |= utils.Check("channel-access", "part")
else: else:
event["stderr"].write("No channel provided") event["stderr"].write("No channel provided")
event["check_assert"](check)
event["server"].send_part(target) event["server"].send_part(target)
def _id_from_alias(self, alias): def _id_from_alias(self, alias):