From e21b2f6ec76277ee141a42207b4e5d1384fbd270 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Tue, 3 Jan 2012 15:02:57 -0500 Subject: [PATCH] stache: fix case when no image is provided --- modules/stache.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/stache.py b/modules/stache.py index e012ab3..6c20d27 100644 --- a/modules/stache.py +++ b/modules/stache.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 +# -*- coding: utf-8 -*- """ stache.py - mustachify.me module author: mutantmonkey @@ -9,8 +10,13 @@ import web def stache(phenny, input): """.stache - Mustachify an image.""" 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)) -stache.rule = (['stache'], r'(.*)') +stache.rule = (['stache'], + '(https?:\/\/[^ #]+\.(?:png|jpg|jpeg))(?:[#]\.png)?') if __name__ == '__main__': print(__doc__.strip())