From c9d07b6032f5aca3b0fcf8027507a64f2fb942f0 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 30 Jan 2020 11:50:57 +0000 Subject: make sure we always have a channel when require_mode/access is present --- src/core_modules/check_mode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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 bb4cb3a9..a320af8d 100644 --- a/src/core_modules/check_mode.py +++ b/src/core_modules/check_mode.py @@ -13,7 +13,7 @@ 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 channel and require_mode: + if channel: if require_mode in LOWHIGH: require_mode = channel.get_setting("mode-%s" % require_mode, LOWHIGH[require_mode]) @@ -31,6 +31,8 @@ class Module(ModuleManager.BaseModule): "You do not have permission to do this") else: return utils.consts.PERMISSION_FORCE_SUCCESS, None + else: + raise ValueError("_command_check requires a channel") @utils.hook("preprocess.command") def preprocess_command(self, event): -- cgit v1.3.1-10-gc9f91