From f51b06aae198231841ccbd2e2c19de3524856348 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 24 Jan 2020 16:26:53 +0000 Subject: check "channel" coming from command_spec.py parsing (check_mode, channel_access) --- src/core_modules/check_mode.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/core_modules/check_mode.py') diff --git a/src/core_modules/check_mode.py b/src/core_modules/check_mode.py index e5430229..6b246118 100644 --- a/src/core_modules/check_mode.py +++ b/src/core_modules/check_mode.py @@ -13,10 +13,10 @@ LOWHIGH = { "Set which channel mode is considered to be 'high' access", example="o")) class Module(ModuleManager.BaseModule): def _check_command(self, event, channel, require_mode): - if event["is_channel"] and require_mode: + print(channel) + if channel and require_mode: if require_mode in LOWHIGH: - require_mode = event["target"].get_setting( - "mode-%s" % require_mode, + require_mode = channel.get_setting("mode-%s" % require_mode, LOWHIGH[require_mode]) elif require_mode == "admin": previous = None @@ -27,9 +27,7 @@ class Module(ModuleManager.BaseModule): previous = mode elif require_mode == "highest": require_mode = event["server"].prefix_modes[0][0] - - if not event["target"].mode_or_above(event["user"], - require_mode): + if not channel.mode_or_above(event["user"], require_mode): return (utils.consts.PERMISSION_ERROR, "You do not have permission to do this") else: @@ -39,7 +37,9 @@ class Module(ModuleManager.BaseModule): def preprocess_command(self, event): require_mode = event["hook"].get_kwarg("require_mode") if not require_mode == None: - return self._check_command(event, event["target"], require_mode) + channel = event["kwargs"].get("channel", + event["target"] if event["is_channel"] else None) + return self._check_command(event, channel, require_mode) @utils.hook("check.command.channel-mode") def check_command(self, event): -- cgit v1.3.1-10-gc9f91