Created
October 26, 2015 08:06
-
-
Save Xe/5bba9db3c155113d0628 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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