Skip to content

Instantly share code, notes, and snippets.

@pberry
Created March 3, 2011 23:22
Show Gist options
  • Save pberry/853842 to your computer and use it in GitHub Desktop.
Save pberry/853842 to your computer and use it in GitHub Desktop.
def wine(self, irc, msg, args):
"""Get a nice glass of wine
"""
json = urlopen("http://www.patandkat.com/json/wine.json").read()
wines = []
for bottle in simplejson.loads(json):
wines.append(bottle['url'],bottle['wine'])
wine = wines[randint(0, len(wines))]
if len(args) > 0:
nick = ' '.join(args)
else:
nick = msg.nick
irc.reply("fills a glass with %s for %s (%s)" % (wine[1], nick, wine[0]), action=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment