stache: fix case when no image is provided

master
mutantmonkey 2012-01-03 15:02:57 -05:00
parent 585523cf7b
commit e21b2f6ec7
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*-
""" """
stache.py - mustachify.me module stache.py - mustachify.me module
author: mutantmonkey <mutantmonkey@mutantmonkey.in> author: mutantmonkey <mutantmonkey@mutantmonkey.in>
@ -9,8 +10,13 @@ import web
def stache(phenny, input): def stache(phenny, input):
""".stache <url> - Mustachify an image.""" """.stache <url> - Mustachify an image."""
url = input.group(2) url = input.group(2)
if not url:
phenny.reply("Please provide an image to Mustachify™.")
return
phenny.reply('http://mustachify.me/?src=' + web.quote(url)) phenny.reply('http://mustachify.me/?src=' + web.quote(url))
stache.rule = (['stache'], r'(.*)') stache.rule = (['stache'],
'(https?:\/\/[^ #]+\.(?:png|jpg|jpeg))(?:[#]\.png)?')
if __name__ == '__main__': if __name__ == '__main__':
print(__doc__.strip()) print(__doc__.strip())