From 21694c39a50e4ac02391cffb9d69ebfb27ce5167 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 13 Jan 2020 16:32:45 +0000 Subject: [PATCH] allow !part to work for "current channel" when op/!access --- src/core_modules/admin.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core_modules/admin.py b/src/core_modules/admin.py index 364380d4..3a92dd39 100644 --- a/src/core_modules/admin.py +++ b/src/core_modules/admin.py @@ -33,18 +33,22 @@ class Module(ModuleManager.BaseModule): event["stderr"].write("Line was filtered") @utils.hook("received.command.part") + @utils.kwarg("help", "Part from the current or given channel") + @utils.kwarg("usage", "[channel]") def part(self, event): - """ - :help: Part from the current or given channel - :usage: [channel] - :permission: part - """ + check = utils.Check("permission", "part") + if event["args"]: target = event["args_split"][0] elif event["is_channel"]: target = event["target"].name + check |= utils.Check("channel-mode", "high") + check |= utils.Check("channel-access", "part") else: event["stderr"].write("No channel provided") + + event["check_assert"](check) + event["server"].send_part(target) def _id_from_alias(self, alias):