Nice place name for UNIX time
This commit is contained in:
parent
d7bc5c1cce
commit
e959c27d66
1 changed files with 8 additions and 3 deletions
|
@ -20,8 +20,13 @@ def time_command(inp, bot=None):
|
||||||
time = " ".join(request.xpath("//pod[@title='Result']/subpod/plain" \
|
time = " ".join(request.xpath("//pod[@title='Result']/subpod/plain" \
|
||||||
"text/text()"))
|
"text/text()"))
|
||||||
time = time.replace(" | ", ", ")
|
time = time.replace(" | ", ", ")
|
||||||
place = " ".join(request.xpath("//pod[@title='Input interpretation']/" \
|
|
||||||
"subpod/plaintext/text()"))[16:].title()
|
# nice place name for UNIX time
|
||||||
|
if inp.lower() == "unix":
|
||||||
|
place = "Unix Epoch"
|
||||||
|
else:
|
||||||
|
place = " ".join(request.xpath("//pod[@title='Input interpretation']/" \
|
||||||
|
"subpod/plaintext/text()"))[16:].title()
|
||||||
|
|
||||||
if time:
|
if time:
|
||||||
# if wolfram alpha had to guess a place, then show the place it chose
|
# if wolfram alpha had to guess a place, then show the place it chose
|
||||||
|
@ -31,4 +36,4 @@ def time_command(inp, bot=None):
|
||||||
# return time
|
# return time
|
||||||
return "%s - \x02%s\x02" % (time, place)
|
return "%s - \x02%s\x02" % (time, place)
|
||||||
else:
|
else:
|
||||||
return "Could not get the time for '%s'" % inp
|
return "Could not get the time for '%s'" % inp
|
||||||
|
|
Reference in a new issue