From 2da9ed09c1d55d274632074d76ca60b1feff2c51 Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Tue, 1 Apr 2014 18:53:17 -0400 Subject: [PATCH] Removed .posted, .lines, augmented title retrieval. --- modules/head.py | 7 +----- modules/linx.py | 64 ++----------------------------------------------- phenny | 2 +- 3 files changed, 4 insertions(+), 69 deletions(-) diff --git a/modules/head.py b/modules/head.py index bc0df6f..c68d834 100644 --- a/modules/head.py +++ b/modules/head.py @@ -13,7 +13,6 @@ import time from html.entities import name2codepoint import web from tools import deprecated -from modules.linx import get_title as linx_gettitle def head(phenny, input): @@ -90,11 +89,7 @@ noteuri.priority = 'low' def snarfuri(phenny, input): uri = input.group(1) - - if phenny.config.linx_api_key != "": - title = linx_gettitle(phenny, uri, input.sender) - else: - title = gettitle(phenny, uri) + title = gettitle(phenny, uri) if title: phenny.msg(input.sender, title) diff --git a/modules/linx.py b/modules/linx.py index 4537031..a7ace62 100644 --- a/modules/linx.py +++ b/modules/linx.py @@ -10,14 +10,6 @@ import web import json -def get_title(phenny, url, channel): - """ Have linx retrieve the (augmented) title """ - try: - return web.post("https://linx.li/vtluuggettitle", {'url': url, 'channel': channel, 'api_key': phenny.config.linx_api_key}) - except: - return - - def linx(phenny, input, short=False): """.linx - Upload a remote URL to linx.li.""" @@ -27,9 +19,9 @@ def linx(phenny, input, short=False): return try: - req = web.post("https://linx.li/vtluug", {'url': url, 'short': short, 'api_key': phenny.config.linx_api_key}) + req = web.post("https://linx.li/upload/remote", {'url': url, 'short': short, 'api_key': phenny.config.linx_api_key}) except (web.HTTPError, web.ConnectionError): - raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.") + raise GrumbleError("Couldn't reach linx.li") data = json.loads(req) if len(data) <= 0 or not data['success']: @@ -46,55 +38,3 @@ def lnx(phenny, input): """ linx(phenny, input, True) lnx.rule = (['lnx'], r'(.*)') - - -def lines(phenny, input): - """.lines () - Returns the number of lines a user posted on a specific date.""" - - if input.group(2): - info = input.group(2).split(" ") - - if len(info) == 1: - nickname = info[0] - date = "today" - elif len(info) == 2: - nickname = info[0] - date = info[1] - else: - phenny.reply(".lines () - Returns the number of lines a user posted on a specific date.") - return - - else: - nickname = input.nick - date = "today" - - try: - req = web.post("https://linx.li/vtluuglines", {'nickname': nickname, 'date': date, 'sender': input.nick, 'channel': input.sender, 'api_key': phenny.config.linx_api_key}) - except (web.HTTPError, web.ConnectionError): - raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.") - - phenny.reply(req) - -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("https://linx.li/vtluugposted", {'message': message, 'sender': input.nick, 'channel': input.sender, 'api_key': phenny.config.linx_api_key}) - except (web.HTTPError, web.ConnectionError): - raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.") - - phenny.reply(req) - -posted.rule = (['posted'], r'(.*)') - - -if __name__ == '__main__': - print(__doc__.strip()) diff --git a/phenny b/phenny index 8c59aed..1d5ce00 100755 --- a/phenny +++ b/phenny @@ -38,7 +38,7 @@ def create_default_config(fn): # password = 'example' # serverpass = 'serverpass' - # linx-enabled features (.linx, .posted, .lines, snarfuri with special capabilities) + # linx-enabled features (.linx, .lnx) # leave the api key blank to not use them and be sure to add the 'linx' module to the ignore list. linx_api_key = ""