Use the command_args_parser in the send_delayed plugin

This commit is contained in:
mathieui 2015-11-11 20:56:10 +01:00
parent ecd7531df9
commit 4b8d66da0c

View file

@ -19,6 +19,7 @@ This plugin adds a command to the chat tabs.
""" """
from plugin import BasePlugin from plugin import BasePlugin
from decorators import command_args_parser
import tabs import tabs
import common import common
import timed_events import timed_events
@ -33,16 +34,17 @@ class Plugin(BasePlugin):
short='Send a message later', short='Send a message later',
completion=self.completion_delay) completion=self.completion_delay)
def command_delayed(self, arg): @command_args_parser.quoted(2)
args = common.shell_split(arg) def command_delayed(self, args):
if len(args) != 2: if args is None:
return return
delay = common.parse_str_to_secs(args[0]) delay_str, txt = args
if not delay: delay = common.parse_str_to_secs(delay_str)
if not delay_str:
return return
tab = self.api.current_tab() 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) self.api.add_timed_event(timed_event)
def completion_delay(self, the_input): def completion_delay(self, the_input):