From a951f0d3a70419337633d17bc3a4eef6b35604d0 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Tue, 27 Mar 2012 23:20:18 -0400 Subject: [PATCH] update linx module from andreim --- modules/linx.py | 90 ++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 34 deletions(-) diff --git a/modules/linx.py b/modules/linx.py index a990f3b..da5c1d8 100644 --- a/modules/linx.py +++ b/modules/linx.py @@ -1,34 +1,56 @@ -#!/usr/bin/python3 -""" -linx.py - linx.li uploader -author: mutantmonkey -""" - -from urllib.error import HTTPError -import web -import json - -def linx(phenny, input): - """.linx - Upload a URL to linx.li.""" - - url = input.group(2) - if not url: - phenny.reply("No URL provided. CAN I HAS?") - return - - try: - req = web.post("http://linx.li/vtluug", {'url': url}) - except (HTTPError, IOError): - phenny.reply("THE INTERNET IS FUCKING BROKEN. Please try again later.") - return - - data = json.loads(req) - if len(data) <= 0 or not data['success']: - phenny.reply('Sorry, upload failed.') - return - - phenny.reply(data['url']) -linx.rule = (['linx'], r'(.*)') - -if __name__ == '__main__': - print(__doc__.strip()) +#!/usr/bin/python3 +""" +linx.py - linx.li tools +author: mutantmonkey , andreim +""" + +from urllib.error import HTTPError +import web +import json + +def linx(phenny, input): + """.linx - Upload a URL to linx.li.""" + + url = input.group(2) + if not url: + phenny.reply("No URL provided. CAN I HAS?") + return + + try: + req = web.post("http://linx.li/vtluug", {'url': url}) + except (HTTPError, IOError): + phenny.reply("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + + data = json.loads(req) + if len(data) <= 0 or not data['success']: + phenny.reply('Sorry, upload failed.') + return + + phenny.reply(data['url']) +linx.rule = (['linx'], r'(.*)') + +if __name__ == '__main__': + print(__doc__.strip()) + +def lines(phenny, input): + """.lines - Returns the number of lines a user posted on a specific date.""" + + nickname = input.group(2) + date = input.group(3) + if not nickname or not date: + phenny.reply(".lines - Returns the number of lines a user posted on a specific date.") + return + + try: + req = web.post("http://linx.li/vtluuglines", {'nickname': nickname, 'date': date}) + except (HTTPError, IOError): + phenny.reply("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + + phenny.reply(req) + +lines.rule = (['lines'], r'([a-z0-9\-_\\]+) (.*)') + +if __name__ == '__main__': + print(__doc__.strip())