diff --git a/modules/check_mode.py b/modules/check_mode.py index f4922549..cdc1dc12 100644 --- a/modules/check_mode.py +++ b/modules/check_mode.py @@ -1,11 +1,23 @@ - from src import ModuleManager, utils +LOWHIGH = { + "low": "v", + "high": "o" +} +@utils.export("channelset", {"setting": "mode-low", + "help": "Set which channel mode is considered to be 'low' access") +@utils.export("channelset", {"setting": "mode-high", + "help": "Set which channel mode is considered to be 'high' access") class Module(ModuleManager.BaseModule): @utils.hook("preprocess.command") def preprocess_command(self, event): require_mode = event["hook"].get_kwarg("require_mode") if event["is_channel"] and require_mode: + if require_mode.lower() in LOWHIGH: + require_mode = event["target"].get_setting( + "mode-%s" % require_mode.lower(), + LOWHIGH[require_mode.lower()]) + if not event["target"].mode_or_above(event["user"], require_mode): return "You do not have permission to do this" diff --git a/modules/set.py b/modules/set.py index ceef713a..8516e443 100644 --- a/modules/set.py +++ b/modules/set.py @@ -51,11 +51,11 @@ class Module(ModuleManager.BaseModule): self._set("set", event, event["user"], event["command"]=="setadd") @utils.hook("received.command.channelset", channel_only=True, - require_mode="o", help=CHANNELSET_HELP) + require_mode="high", help=CHANNELSET_HELP) @utils.hook("received.command.channelsetoverride", channel_only=True, permission="channelsetoverride", help=CHANNELSET_HELP) @utils.hook("received.command.channelsetadd", channel_only=True, - require_mode="o", help=CHANNELSETADD_HELP) + require_mode="high", help=CHANNELSETADD_HELP) @utils.hook("received.command.channelsetaddoverride", channel_only=True, permission="channelsetoverride", help=CHANNELSETADD_HELP) def channel_set(self, event):