Skip to content

Commit

Permalink
Time: Make argument to @at optional. (Replacement for GH-533 that doe…
Browse files Browse the repository at this point in the history
…s not need nesting.)
  • Loading branch information
progval committed Dec 28, 2013
1 parent df375e0 commit 9ff1483
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/Time/plugin.py
Expand Up @@ -95,13 +95,17 @@ def seconds(self, irc, msg, args):
irc.reply(str(seconds))

@internationalizeDocstring
def at(self, irc, msg, args, s):
"""<time string>
def at(self, irc, msg, args, s=None):
"""[<time string>]
Returns the number of seconds since epoch <time string> is.
<time string> can be any number of natural formats; just try something
and see if it will work.
If the <time string> is not given, defaults to now.
"""
if not s:
irc.reply(str(int(time.time())))
return
if not parse:
irc.error(_('This command is not available on this bot, ask the '
'owner to install the python-dateutil library.'), Raise=True)
Expand All @@ -111,7 +115,7 @@ def at(self, irc, msg, args, s):
irc.reply(str(new))
else:
irc.error(_('That\'s right now!'))
at = wrap(at, ['text'])
at = wrap(at, [optional('text')])

@internationalizeDocstring
def until(self, irc, msg, args, s):
Expand Down

0 comments on commit 9ff1483

Please sign in to comment.