aboutsummaryrefslogtreecommitdiff
path: root/modules/channel_op.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-08-14 15:07:48 +0100
committerGravatar jesopo2019-08-14 15:07:48 +0100
commitf1dfbd112ffcebbd64bc0d6491bfcd9624bf3002 (patch)
tree909254409dc90858a56bd390230ec2acc3b32631 /modules/channel_op.py
parentadd configurable default kick message per bot/server/channel (diff)
signature
switch `!mute` to use `+1s` duration format
Diffstat (limited to 'modules/channel_op.py')
-rw-r--r--modules/channel_op.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py
index c3f20ba2..71126b76 100644
--- a/modules/channel_op.py
+++ b/modules/channel_op.py
@@ -174,18 +174,18 @@ class Module(ModuleManager.BaseModule):
return None, None
raise ValueError("Unknown mute-method '%s'" % mute_method)
- @utils.hook("received.command.mute", usage="<nickname> [duration]")
+ @utils.hook("received.command.mute", usage="[+time] <nickname>")
@utils.hook("received.command.unmute", usage="<nickname>")
@utils.kwarg("min_args", 1)
@utils.kwarg("channel_only", True)
@utils.kwarg("require_mode", "o")
@utils.kwarg("require_access", "mute")
@utils.kwarg("help", "Mute a given user")
- @utils.kwarg("usage", "<nickname>")
def _mute(self, event):
add = event.name == "received.command.mute"
+ time, args = self._parse_time(event["args_split"], 1)
- target_name = event["args_split"][0]
+ target_name = args[0]
if not event["server"].has_user(target_name):
raise utils.EventError("No such user")
@@ -197,12 +197,8 @@ class Module(ModuleManager.BaseModule):
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])
- if duration == None:
- raise utils.EventError("Invalid duration")
-
- self.timers.add_persistent("unmute", duration,
+ if add and time:
+ self.timers.add_persistent("unmute", time,
server_id=event["server"].id, channel_name=event["target"].name,
mode=mode, mask=mask)