add +time param to !silence
This commit is contained in:
parent
695c7982a6
commit
0c5171a44f
1 changed files with 12 additions and 1 deletions
|
@ -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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue