diff options
| author | 2018-09-26 18:27:17 +0100 | |
|---|---|---|
| committer | 2018-09-26 18:27:17 +0100 | |
| commit | 51a52e2b0e54031cce5876f54d1d48c268b5441c (patch) | |
| tree | a4c0e8e86c55aa701b06297d5b5a2ceebeaab60d /modules/in.py | |
| parent | Also use docstrings to check if a command has help available, allow one-string (diff) | |
Switch to using @Utils.hook and docstrings for event hooks
Diffstat (limited to 'modules/in.py')
| -rw-r--r-- | modules/in.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/in.py b/modules/in.py index 2351fb11..52363fec 100644 --- a/modules/in.py +++ b/modules/in.py @@ -7,11 +7,12 @@ SECONDS_MAX_DESCRIPTION = "8 weeks" class Module(object): def __init__(self, bot, events, exports): self.bot = bot - events.on("received.command.in").hook(self.in_command, min_args=2, - help="Set a reminder", usage="<time> <message>") - events.on("timer.in").hook(self.timer_due) + @Utils.hook("received.command.in", min_args=2, usage="<time> <message>") def in_command(self, event): + """ + Set a reminder + """ seconds = Utils.from_pretty_time(event["args_split"][0]) message = " ".join(event["args_split"][1:]) if seconds: @@ -31,6 +32,7 @@ class Module(object): event["stderr"].write( "Please provided a valid time above 0 seconds") + @Utils.hook("timer.in") def timer_due(self, event): for server in self.bot.servers.values(): if event["server_id"] == server.id: |
