From 4713648a631c74c20c3ab7c9b1e91789ec0ef7a6 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 9 Aug 2015 16:24:41 -0700 Subject: [PATCH] Add skybot plugin This plugin is unsupported. If it works for you, great. If it doesn't, also great. It really is unsupported and no help on usage will be given. --- client/skybot/pony.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 client/skybot/pony.py diff --git a/client/skybot/pony.py b/client/skybot/pony.py new file mode 100644 index 0000000..45261ce --- /dev/null +++ b/client/skybot/pony.py @@ -0,0 +1,40 @@ +from util import hook + +import datetime +import ponyapi + +@hook.command +def countdown(inp, say=None): + "Shows the countdown to the new episode of My Little Pony: Friendship is Magic!" + now = datetime.datetime(2006, 1, 1) + now = now.now() + ep = ponyapi.newest() + then = now.fromtimestamp(int(ep[u"air_date"])) + td = then-now + + seasonep = "" + + 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) + + return reply + +@hook.command +def randomep(inp): + "Shows a random episode of My Little Pony: Friendship is Magic" + ep = ponyapi.random() + + seasonep = "" + + if ep[u"is_movie"]: + seasonep = "(a movie)" + else: + seasonep = "(season %d episode %d)" % (ep[u"season"], ep[u"episode"]) + + return "%s %s" % (ep[u"name"], seasonep)