.lnx to return short remote uploaded links

master
Andrei M 2012-08-30 01:43:05 -04:00
parent 24a6907049
commit 7f55eb7cc5
1 changed files with 11 additions and 3 deletions

View File

@ -10,8 +10,8 @@ import web
import json
def linx(phenny, input):
""".linx <url> - Upload a URL to linx.li."""
def linx(phenny, input, short=False):
""".linx <url> - Upload a remote URL to linx.li."""
url = input.group(2)
if not url:
@ -19,7 +19,7 @@ def linx(phenny, input):
return
try:
req = web.post("http://linx.li/vtluug", {'url': url})
req = web.post("http://linx.li/vtluug", {'url': url, 'short': short})
except (HTTPError, IOError):
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
@ -32,6 +32,14 @@ def linx(phenny, input):
linx.rule = (['linx'], r'(.*)')
def lnx(phenny, input):
"""
same as .linx but returns a short url.
"""
linx(phenny, input, True)
lnx.rule = (['lnx'], r'(.*)')
def lines(phenny, input):
""".lines <nickname> (<today/yesterday/YYYYMMDD>) - Returns the number of lines a user posted on a specific date."""