From 2c9a937c2ea94e698e1163d478cd6fd302809ea9 Mon Sep 17 00:00:00 2001 From: Andrei M Date: Fri, 22 Jun 2012 02:29:31 +0300 Subject: [PATCH] .posted --- modules/linx.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/modules/linx.py b/modules/linx.py index bbf712a..da5d8fd 100644 --- a/modules/linx.py +++ b/modules/linx.py @@ -9,6 +9,7 @@ from tools import GrumbleError import web import json + def linx(phenny, input): """.linx - Upload a URL to linx.li.""" @@ -30,8 +31,6 @@ def linx(phenny, input): 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.""" @@ -62,5 +61,23 @@ def lines(phenny, input): lines.rule = (['lines'], r'(.*)') + +def posted(phenny, input): + """.posted - Checks if has already been posted.""" + + message = input.group(2) + if not message: + phenny.say(".posted - Checks if has already been posted.") + return + + try: + req = web.post("http://linx.li/vtluugposted", {'message': message, 'sender': input.nick}) + except (HTTPError, IOError): + raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.") + + phenny.reply(req) + +posted.rule = (['posted'], r'(.*)') + if __name__ == '__main__': - print(__doc__.strip()) + print(__doc__.strip()) \ No newline at end of file