web.isgd() now throws an error when it cant shorten a URL

This commit is contained in:
Luke Rogers 2012-10-13 12:10:02 +13:00
parent 28345b9c56
commit 72ed3c504f
5 changed files with 36 additions and 15 deletions

View file

@ -6,5 +6,9 @@ from util import hook, web, http
def lmgtfy(inp, bot=None):
"lmgtfy [phrase] - Posts a google link for the specified phrase"
url = "http://lmgtfy.com/?q=%s" % http.quote_plus(inp)
return web.isgd(url)
link = "http://lmgtfy.com/?q=%s" % http.quote_plus(inp)
try:
return web.isgd(link)
except (web.ShortenError, http.HTTPError):
return link