fix for hiatus

This commit is contained in:
Christine Dodrill 2015-11-28 18:34:20 -08:00
parent 4d5a05614d
commit c8b152e3fe
1 changed files with 17 additions and 13 deletions

View File

@ -16,23 +16,27 @@ def get_time(ep):
def when(inp, say=None):
#"Shows the countdown to the new episode of My Little Pony: Friendship is Magic!"
ep = ponyapi.newest()
now, then, td = get_time(ep)
seasonep = ""
try:
ep = ponyapi.newest()
now, then, td = get_time(ep)
seasonep = ""
if inp == "discord":
return "%s will air on %s" % (ep[u"name"], DDate(then))
if inp == "discord":
return "%s will air on %s" % (ep[u"name"], DDate(then))
if ep[u"is_movie"]:
seasonep = "(a movie)"
else:
seasonep = "(season %d episode %d)" % (ep[u"season"], ep[u"episode"])
if ep[u"is_movie"]:
seasonep = "(a movie)"
else:
seasonep = "(season %d episode %d)" % (ep[u"season"], ep[u"episode"])
reply = "%s %s will air on %s in %d days!" % (
ep[u"name"], seasonep, then.strftime("%a, %d %b %Y %H:%M:%S"),
td.days)
reply = "%s %s will air on %s in %d days!" % (
ep[u"name"], seasonep, then.strftime("%a, %d %b %Y %H:%M:%S"),
td.days)
return reply
return reply
except:
return "404! We're on hiatus!"
@hook.command
def randomep(inp):