time.py now handles unknown locations correctly
This commit is contained in:
parent
5468d80b69
commit
a018763cb7
|
@ -22,19 +22,13 @@ def time_command(inp, bot=None):
|
||||||
"text/text()"))
|
"text/text()"))
|
||||||
time = time.replace(" | ", ", ")
|
time = time.replace(" | ", ", ")
|
||||||
|
|
||||||
# nice place name for UNIX time
|
|
||||||
if inp.lower() == "unix":
|
|
||||||
place = "Unix Epoch"
|
|
||||||
else:
|
|
||||||
place = capitalize_first(" ".join(request.xpath("//pod[@title='Input" \
|
|
||||||
" interpretation']/subpod/plaintext/text()"))[16:])
|
|
||||||
|
|
||||||
if time:
|
if time:
|
||||||
# if wolfram alpha had to guess a place, then show the place it chose
|
# nice place name for UNIX time
|
||||||
#if request.xpath("//assumptions"):
|
if inp.lower() == "unix":
|
||||||
# return "%s - \x02%s\x02" % (time, place)
|
place = "Unix Epoch"
|
||||||
#else:
|
else:
|
||||||
# return time
|
place = capitalize_first(" ".join(request.xpath("//pod[@" \
|
||||||
|
"title='Input interpretation']/subpod/plaintext/text()"))[16:])
|
||||||
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