diff options
author | mathieui <mathieui@mathieui.net> | 2015-11-11 20:56:10 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-11-11 20:56:10 +0100 |
commit | 4b8d66da0c9debf4005a2080573653115dd8374e (patch) | |
tree | de310353a2e2c2c284966c89f9f707ddb7c901b4 | |
parent | ecd7531df98f894edecaa2cfffd6f3b26386546c (diff) | |
download | poezio-4b8d66da0c9debf4005a2080573653115dd8374e.tar.gz poezio-4b8d66da0c9debf4005a2080573653115dd8374e.tar.bz2 poezio-4b8d66da0c9debf4005a2080573653115dd8374e.tar.xz poezio-4b8d66da0c9debf4005a2080573653115dd8374e.zip |
Use the command_args_parser in the send_delayed plugin
-rw-r--r-- | plugins/send_delayed.py | 14 |
1 files 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): |