phenny-1/modules/short.py

30 lines
607 B
Python
Raw Normal View History

2012-05-03 21:58:28 -04:00
#!/usr/bin/python3
2012-05-03 21:57:46 -04:00
"""
short.py - vtluug url shortner
author: andreim <andreim@andreim.net>
"""
from tools import GrumbleError
2012-05-03 21:57:46 -04:00
import web
import json
2013-06-09 01:27:24 -04:00
2012-05-03 21:57:46 -04:00
def short(phenny, input):
""".short <url> - Shorten a URL."""
url = input.group(2)
if not url:
phenny.reply("No URL provided. CAN I HAS?")
return
try:
2013-06-09 01:27:24 -04:00
r = web.post("http://vtlu.ug/vtluug", {'lurl': url})
except:
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
2012-05-03 21:57:46 -04:00
2013-06-09 01:27:24 -04:00
phenny.reply(r)
2012-05-03 22:03:09 -04:00
short.rule = (['short'], r'(.*)')
2012-05-03 21:57:46 -04:00
if __name__ == '__main__':
print(__doc__.strip())