add catgif

This commit is contained in:
Gordon Shumway 2019-02-28 20:20:39 -05:00 committed by GitHub
parent 6ef5e20ec8
commit 441be76b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -285,5 +285,20 @@ class Fun(callbacks.Plugin):
elif botchoice == "paper" and userchoice == "scissors":
irc.reply("I chose %s. Looks like you won." % (botchoice))
scissors = wrap(scissors)
def catgif(self, irc, msg, args):
"""
Get a random cat .gif
"""
try:
response = utils.web.getUrl("http://edgecats.net/random").decode("utf8")
# Expecting a link
if "http" in response:
irc.reply(response)
else:
self.log.error("Received unexpected response from http://edgecats.net/random")
except:
self.log.exception("Error fetching URL")
catgif = wrap(catgif)
Class = Fun