Skip to content

Instantly share code, notes, and snippets.

@Xe
Created October 26, 2015 08:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xe/5bba9db3c155113d0628 to your computer and use it in GitHub Desktop.
Save Xe/5bba9db3c155113d0628 to your computer and use it in GitHub Desktop.
from util import hook
import requests, re
@hook.command
def printerfact(inp, say=None):
r = requests.get('https://catfacts-api.appspot.com/api/facts?number=1')
fact = r.json()['facts'][0]
regex = re.compile(re.escape("cat"), re.IGNORECASE)
return regex.sub("printer", fact)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment