From 382f46d7be57bb90bebb7ce2463ca0bd7106acb9 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 2 Jan 2015 12:22:07 -0800 Subject: [PATCH] Time.time: reintroduce ability to specify --- plugins/Time/plugin.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/Time/plugin.py b/plugins/Time/plugin.py index 4509f5085..befe6943d 100644 --- a/plugins/Time/plugin.py +++ b/plugins/Time/plugin.py @@ -159,15 +159,16 @@ class Time(callbacks.Plugin): TIME.time)]) @internationalizeDocstring - def time(self, irc, msg, args, format, seconds): - """[] [] + def time(self, irc, msg, args, channel, format, seconds): + """[] [] [] Returns the current time in format, or, if is not given, uses the configurable format for the current channel. If no - time is given, the current time is used. + time is given, the current time is used. If + is given without , uses the format for . """ if not format: - format = self.registryValue('format', msg.args[0]) + format = self.registryValue('format', channel or msg.args[0]) if tzlocal: irc.reply(datetime.fromtimestamp(seconds, tzlocal()).strftime(format)) else: @@ -175,7 +176,8 @@ class Time(callbacks.Plugin): # including at least up to 2.7.5 and 3.2.3. Install dateutil if you # can't upgrade Python. irc.reply(time.strftime(format, time.localtime(seconds))) - time = wrap(time, [optional('nonInt'), additional('float', TIME.time)]) + time = wrap(time, [optional('channel'), optional('nonInt'), + additional('float', TIME.time)]) @internationalizeDocstring def elapsed(self, irc, msg, args, seconds):