From dc8c63c11b011d18ffe294306ea2ed68a7787d99 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 10 Jul 2019 08:56:51 +0100 Subject: add ability to disable !mute for networks that dont support mutes --- modules/channel_op.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/channel_op.py b/modules/channel_op.py index 4b2dbe15..f7cbc484 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -20,7 +20,8 @@ class InvalidTimeoutException(Exception): "Set ban format ($n = nick, $u = username, $h = hostname)", example="*!$u@$h")) @utils.export("serverset", utils.OptionsSetting("mute-method", - ["qmode", "insp", "unreal"], "Set this server's method of muting users")) + ["qmode", "insp", "unreal", "none"], + "Set this server's method of muting users")) class Module(ModuleManager.BaseModule): _name = "ChanOp" @@ -319,6 +320,8 @@ class Module(ModuleManager.BaseModule): return "b", "m:%s" % mask elif mute_method == "unreal": return "b", "~q:%s" % mask + elif mute_method == "none": + return None, None raise ValueError("Unknown mute-method '%s'" % mute_method) @utils.hook("received.command.mute", usage=" [duration]") @@ -341,6 +344,8 @@ class Module(ModuleManager.BaseModule): raise utils.EventError("No such user") mode, mask = self._mute_method(event["server"], target_user) + if mode == None: + raise utils.EventError("This network doesn't support mutes") if add and len(event["args_split"]) > 1: duration = utils.from_pretty_time(event["args_split"][1]) -- cgit v1.3.1-10-gc9f91