diff --git a/modules/silence.py b/modules/silence.py index 4dda2894..895644d1 100644 --- a/modules/silence.py +++ b/modules/silence.py @@ -17,13 +17,24 @@ class Module(ModuleManager.BaseModule): return False @utils.hook("received.command.silence", channel_only=True) + @utils.kwarg("help", "Prevent me saying anything for a period of time " + "(default: 5 minutes)") + @utils.kwarg("usage", "[+time]") + @utils.kwarg("require_mode", "high") + @utils.kwarg("permission", "silence") def silence(self, event): """ :help: Silence me for 5 minutes :require_mode: high :permission: silence """ - silence_until = time.time()+SILENCE_TIME + duration = SILENCE_TIME + if event["args"] and event["args_split"][0].startswith("+"): + duration = utils.from_pretty_time(event["args_split"][0][1:]) + if duration == None: + raise utils.EventError("Invalid duration provided") + + silence_until = time.time()+duration event["target"].set_setting("silence-until", silence_until) event["stdout"].write("Ok, I'll be back")