[title] Restrict accepted URLs (only https?://)
parent
113c7f86e1
commit
03fd6b2017
4
title.py
4
title.py
|
@ -14,10 +14,12 @@ def title(phenny, input):
|
||||||
uri = input.group(2)
|
uri = input.group(2)
|
||||||
if uri:
|
if uri:
|
||||||
uri = uri.strip()
|
uri = uri.strip()
|
||||||
|
if not uri.startswith("http://") and not uri.startswith("https://"):
|
||||||
|
return phenny.say("That's not a valid URL")
|
||||||
elif hasattr(phenny.bot, 'last_seen_uri'):
|
elif hasattr(phenny.bot, 'last_seen_uri'):
|
||||||
uri = phenny.bot.last_seen_uri
|
uri = phenny.bot.last_seen_uri
|
||||||
else:
|
else:
|
||||||
return phenny.reply("Give me an URI..")
|
return phenny.reply("Give me a link.")
|
||||||
data, sc = web.get(uri, 16384)
|
data, sc = web.get(uri, 16384)
|
||||||
if sc != 200:
|
if sc != 200:
|
||||||
return phenny.say("HTTP error %d" % sc)
|
return phenny.say("HTTP error %d" % sc)
|
||||||
|
|
Loading…
Reference in New Issue