aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-13 11:41:04 +0000
committerGravatar jesopo2020-02-13 11:41:04 +0000
commit22af5fae4630583b2999120546cdcd9973a49c82 (patch)
treec30a107c37bb2890665b60fb1a54cc31afffe8ce /src
parentactually raise exception for !modinfo not found (diff)
signature
update !silence to use command specs
Diffstat (limited to 'src')
-rw-r--r--src/core_modules/silence.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/core_modules/silence.py b/src/core_modules/silence.py
index f7084148..ee384589 100644
--- a/src/core_modules/silence.py
+++ b/src/core_modules/silence.py
@@ -20,21 +20,14 @@ class Module(ModuleManager.BaseModule):
return False
@utils.hook("received.command.silence")
- @utils.kwarg("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("require_access", "low,silence")
@utils.kwarg("permission", "silence")
+ @utils.spec("!-channelonly ?duration")
def silence(self, event):
- duration = SILENCE_TIME
- if event["args"] and event["args_split"][0].startswith("+"):
- duration = utils.datetime.parse.from_pretty_time(
- event["args_split"][0][1:])
- if duration == None:
- raise utils.EventError("Invalid duration provided")
-
+ duration = event["spec"][0] or SILENCE_TIME
silence_until = time.time()+duration
event["target"].set_setting("silence-until", silence_until)
event["stdout"].write("Ok, I'll be back")