From 4b8d66da0c9debf4005a2080573653115dd8374e Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 11 Nov 2015 20:56:10 +0100 Subject: Use the command_args_parser in the send_delayed plugin --- plugins/send_delayed.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/send_delayed.py b/plugins/send_delayed.py index 3f9ed931..cf35f69c 100644 --- a/plugins/send_delayed.py +++ b/plugins/send_delayed.py @@ -19,6 +19,7 @@ This plugin adds a command to the chat tabs. """ from plugin import BasePlugin +from decorators import command_args_parser import tabs import common import timed_events @@ -33,16 +34,17 @@ class Plugin(BasePlugin): short='Send a message later', completion=self.completion_delay) - def command_delayed(self, arg): - args = common.shell_split(arg) - if len(args) != 2: + @command_args_parser.quoted(2) + def command_delayed(self, args): + if args is None: return - delay = common.parse_str_to_secs(args[0]) - if not delay: + delay_str, txt = args + delay = common.parse_str_to_secs(delay_str) + if not delay_str: return tab = self.api.current_tab() - timed_event = timed_events.DelayedEvent(delay, self.say, (tab, args[1])) + timed_event = timed_events.DelayedEvent(delay, self.say, (tab, txt)) self.api.add_timed_event(timed_event) def completion_delay(self, the_input): -- cgit v1.2.3