add ability to disable !mute for networks that dont support mutes
This commit is contained in:
parent
55e5693341
commit
dc8c63c11b
1 changed files with 6 additions and 1 deletions
|
@ -20,7 +20,8 @@ class InvalidTimeoutException(Exception):
|
||||||
"Set ban format ($n = nick, $u = username, $h = hostname)",
|
"Set ban format ($n = nick, $u = username, $h = hostname)",
|
||||||
example="*!$u@$h"))
|
example="*!$u@$h"))
|
||||||
@utils.export("serverset", utils.OptionsSetting("mute-method",
|
@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):
|
class Module(ModuleManager.BaseModule):
|
||||||
_name = "ChanOp"
|
_name = "ChanOp"
|
||||||
|
|
||||||
|
@ -319,6 +320,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
return "b", "m:%s" % mask
|
return "b", "m:%s" % mask
|
||||||
elif mute_method == "unreal":
|
elif mute_method == "unreal":
|
||||||
return "b", "~q:%s" % mask
|
return "b", "~q:%s" % mask
|
||||||
|
elif mute_method == "none":
|
||||||
|
return None, None
|
||||||
raise ValueError("Unknown mute-method '%s'" % mute_method)
|
raise ValueError("Unknown mute-method '%s'" % mute_method)
|
||||||
|
|
||||||
@utils.hook("received.command.mute", usage="<nickname> [duration]")
|
@utils.hook("received.command.mute", usage="<nickname> [duration]")
|
||||||
|
@ -341,6 +344,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
raise utils.EventError("No such user")
|
raise utils.EventError("No such user")
|
||||||
|
|
||||||
mode, mask = self._mute_method(event["server"], target_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:
|
if add and len(event["args_split"]) > 1:
|
||||||
duration = utils.from_pretty_time(event["args_split"][1])
|
duration = utils.from_pretty_time(event["args_split"][1])
|
||||||
|
|
Loading…
Reference in a new issue