From 3df53f95a8ecdadfdea7696f9d17e11e92b6d55b Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 2 Dec 2013 22:55:58 +1300 Subject: [PATCH 1/9] re-added .randomplugin @blha303 --- plugins/minecraft_bukkit.py | 65 +++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/plugins/minecraft_bukkit.py b/plugins/minecraft_bukkit.py index 0c3313e..06d6a52 100644 --- a/plugins/minecraft_bukkit.py +++ b/plugins/minecraft_bukkit.py @@ -1,13 +1,17 @@ from util import hook, http, web import time +import random base_url = "http://api.bukget.org/3/" search_url = base_url + "search/plugin_name/like/{}" +random_url = base_url + "plugins/bukkit/?start={}&size=1" details_url = base_url + "plugins/bukkit/{}" categories = http.get_json("http://api.bukget.org/3/categories") -total_plugins = sum([cat["count"] for cat in categories]) + +count_total = sum([cat["count"] for cat in categories]) +count_categores = {cat["name"].lower() : int(cat["count"]) for cat in categories} # dict conps! class BukgetError(Exception): @@ -40,6 +44,22 @@ def plugin_search(term): return results[0]["slug"] +def plugin_random(): + """ returns the slug of a random plugin from the bukget API """ + results = None + + while not results: + plugin_number = random.randint(1, count_total) + print "trying {}".format(plugin_number) + try: + results = http.get_json(random_url.format(plugin_number)) + except (http.HTTPError, http.URLError) as e: + raise BukgetError(500, "Error Fetching Search Page: {}".format(e)) + + return results[0]["slug"] + + + def plugin_details(slug): """ takes a plugin slug and returns details from the bukget API """ slug = slug.lower().strip() @@ -57,7 +77,7 @@ def plugin_details(slug): def bukkitplugin(inp, reply=None, message=None): """plugin - Look up a plugin on dev.bukkit.org""" # get the plugin slug using search - print total_plugins + print count_categores try: slug = plugin_search(inp) except BukgetError as e: @@ -92,3 +112,44 @@ def bukkitplugin(inp, reply=None, message=None): reply(u"\x02{}\x02, by \x02{}\x02 ({}) \x02{}".format(name, authors, stage, url)) message(u"Last release: \x02v{}\x02 for \x02{}\x02 at {} \x02{}\x02".format(version_number, bukkit_versions, last_update, link)) + + + +@hook.command(autohelp=None) +def randomplugin(inp, reply=None, message=None): + """randomplugin - Gets a random plugin from dev.bukkit.org""" + # get a random plugin slug + try: + slug = plugin_random() + except BukgetError as e: + return e + + # get the plugin info using the slug + try: + data = plugin_details(slug) + except BukgetError as e: + return e + + + name = data["plugin_name"] + description = data['description'] + url = data['website'] + authors = data['authors'][0] + authors = authors[0] + u"\u200b" + authors[1:] + stage = data['stage'] + + current_version = data['versions'][0] + + last_update = time.strftime('%d %B %Y %H:%M', + time.gmtime(current_version['date'])) + version_number = data['versions'][0]['version'] + + bukkit_versions = ", ".join(current_version['game_versions']) + link = web.try_isgd(current_version['link']) + + if description: + reply(u"\x02{}\x02, by \x02{}\x02 - {} - ({}) \x02{}".format(name, authors, description, stage, url)) + else: + reply(u"\x02{}\x02, by \x02{}\x02 ({}) \x02{}".format(name, authors, stage, url)) + + message(u"Last release: \x02v{}\x02 for \x02{}\x02 at {} \x02{}\x02".format(version_number, bukkit_versions, last_update, link)) From 97e7741434080bb98efc26ddc57113f8542e91fe Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 2 Dec 2013 23:03:29 +1300 Subject: [PATCH 2/9] modular! --- plugins/minecraft_bukkit.py | 81 +++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/plugins/minecraft_bukkit.py b/plugins/minecraft_bukkit.py index 06d6a52..6faf676 100644 --- a/plugins/minecraft_bukkit.py +++ b/plugins/minecraft_bukkit.py @@ -23,6 +23,8 @@ class BukgetError(Exception): return self.text +## API FUNCTIONS + def plugin_search(term): """ searches for a plugin with the bukget API and returns the slug """ term = term.lower().strip() @@ -59,7 +61,6 @@ def plugin_random(): return results[0]["slug"] - def plugin_details(slug): """ takes a plugin slug and returns details from the bukget API """ slug = slug.lower().strip() @@ -71,25 +72,10 @@ def plugin_details(slug): return details +## OTHER FUNCTIONS -@hook.command('plugin') -@hook.command -def bukkitplugin(inp, reply=None, message=None): - """plugin - Look up a plugin on dev.bukkit.org""" - # get the plugin slug using search - print count_categores - try: - slug = plugin_search(inp) - except BukgetError as e: - return e - - # get the plugin info using the slug - try: - data = plugin_details(slug) - except BukgetError as e: - return e - - +def format_output(data): + """ takes plugin data and returns two strings representing information about that plugin """ name = data["plugin_name"] description = data['description'] url = data['website'] @@ -107,11 +93,36 @@ def bukkitplugin(inp, reply=None, message=None): link = web.try_isgd(current_version['link']) if description: - reply(u"\x02{}\x02, by \x02{}\x02 - {} - ({}) \x02{}".format(name, authors, description, stage, url)) + line_a = u"\x02{}\x02, by \x02{}\x02 - {} - ({}) \x02{}".format(name, authors, description, stage, url) else: - reply(u"\x02{}\x02, by \x02{}\x02 ({}) \x02{}".format(name, authors, stage, url)) + line_a = u"\x02{}\x02, by \x02{}\x02 ({}) \x02{}".format(name, authors, stage, url) - message(u"Last release: \x02v{}\x02 for \x02{}\x02 at {} \x02{}\x02".format(version_number, bukkit_versions, last_update, link)) + line_b = u"Last release: \x02v{}\x02 for \x02{}\x02 at {} \x02{}\x02".format(version_number, bukkit_versions, last_update, link) + + return line_a, line_b + + +@hook.command('plugin') +@hook.command +def bukkitplugin(inp, reply=None, message=None): + """plugin - Look up a plugin on dev.bukkit.org""" + # get the plugin slug using search + try: + slug = plugin_search(inp) + except BukgetError as e: + return e + + # get the plugin info using the slug + try: + data = plugin_details(slug) + except BukgetError as e: + return e + + # format the final message and send it to IRC + line_a, line_b = format_output(data) + + reply(line_a) + message(line_b) @@ -130,26 +141,8 @@ def randomplugin(inp, reply=None, message=None): except BukgetError as e: return e + # format the final message and send it to IRC + line_a, line_b = format_output(data) - name = data["plugin_name"] - description = data['description'] - url = data['website'] - authors = data['authors'][0] - authors = authors[0] + u"\u200b" + authors[1:] - stage = data['stage'] - - current_version = data['versions'][0] - - last_update = time.strftime('%d %B %Y %H:%M', - time.gmtime(current_version['date'])) - version_number = data['versions'][0]['version'] - - bukkit_versions = ", ".join(current_version['game_versions']) - link = web.try_isgd(current_version['link']) - - if description: - reply(u"\x02{}\x02, by \x02{}\x02 - {} - ({}) \x02{}".format(name, authors, description, stage, url)) - else: - reply(u"\x02{}\x02, by \x02{}\x02 ({}) \x02{}".format(name, authors, stage, url)) - - message(u"Last release: \x02v{}\x02 for \x02{}\x02 at {} \x02{}\x02".format(version_number, bukkit_versions, last_update, link)) + reply(line_a) + message(line_b) \ No newline at end of file From 4236b7bc29341aef45209babe75291fe4082b26d Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 2 Dec 2013 23:04:36 +1300 Subject: [PATCH 3/9] and this --- plugins/minecraft_bukkit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/minecraft_bukkit.py b/plugins/minecraft_bukkit.py index 6faf676..c86c63c 100644 --- a/plugins/minecraft_bukkit.py +++ b/plugins/minecraft_bukkit.py @@ -2,6 +2,8 @@ from util import hook, http, web import time import random +## CONSTANTS + base_url = "http://api.bukget.org/3/" search_url = base_url + "search/plugin_name/like/{}" @@ -23,7 +25,7 @@ class BukgetError(Exception): return self.text -## API FUNCTIONS +## DATA FUNCTIONS def plugin_search(term): """ searches for a plugin with the bukget API and returns the slug """ @@ -102,6 +104,8 @@ def format_output(data): return line_a, line_b +## HOOK FUNCTIONS + @hook.command('plugin') @hook.command def bukkitplugin(inp, reply=None, message=None): From 1e22ca49951914ac895dc551cc27348b6eb396d3 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 2 Dec 2013 23:06:26 +1300 Subject: [PATCH 4/9] ianal --- plugins/minecraft_bukkit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/minecraft_bukkit.py b/plugins/minecraft_bukkit.py index c86c63c..49b4593 100644 --- a/plugins/minecraft_bukkit.py +++ b/plugins/minecraft_bukkit.py @@ -49,7 +49,7 @@ def plugin_search(term): def plugin_random(): - """ returns the slug of a random plugin from the bukget API """ + """ gets a random plugin from the bukget API and returns the slug """ results = None while not results: From be3df6718f7a36e0c224eca704bd96087a113d2a Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 2 Dec 2013 23:10:08 +1300 Subject: [PATCH 5/9] ianalmore --- plugins/minecraft_bukkit.py | 4 ++-- plugins/newegg.py | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/plugins/minecraft_bukkit.py b/plugins/minecraft_bukkit.py index 49b4593..c72b0e5 100644 --- a/plugins/minecraft_bukkit.py +++ b/plugins/minecraft_bukkit.py @@ -1,4 +1,4 @@ -from util import hook, http, web +from util import hook, http, web, text import time import random @@ -79,7 +79,7 @@ def plugin_details(slug): def format_output(data): """ takes plugin data and returns two strings representing information about that plugin """ name = data["plugin_name"] - description = data['description'] + description = text.truncate_str(data['description'], 30) url = data['website'] authors = data['authors'][0] authors = authors[0] + u"\u200b" + authors[1:] diff --git a/plugins/newegg.py b/plugins/newegg.py index 072ad94..1f02cf5 100644 --- a/plugins/newegg.py +++ b/plugins/newegg.py @@ -52,6 +52,8 @@ def format_item(item): tag_text, url) +## HOOK FUNCTIONS + @hook.regex(*NEWEGG_RE) def newegg_url(match): item_id = match.group(1) @@ -65,17 +67,8 @@ def newegg(inp): # form the search request request = { - "PageNumber": 1, - "BrandId": -1, - "NValue": "", - "StoreDepaId": -1, - "NodeId": -1, "Keyword": inp, - "IsSubCategorySearch": False, - "SubCategoryId": -1, - "Sort": "FEATURED", - "CategoryId": -1, - "IsUPCCodeSearch": False + "Sort": "FEATURED" } # submit the search request From 57e53e8eb73d970b4a4d2283ac7c79568b87f686 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Mon, 2 Dec 2013 23:16:34 +1300 Subject: [PATCH 6/9] *dance* --- plugins/coins.py | 62 ++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/plugins/coins.py b/plugins/coins.py index d566c07..bdb0e19 100644 --- a/plugins/coins.py +++ b/plugins/coins.py @@ -1,38 +1,41 @@ from util import http, hook +## CONSTANTS + +exchanges = { + "blockchain": { + "api_url": "https://blockchain.info/ticker", + "func": lambda data: u"Blockchain // Buy: \x0307${:,.2f}\x0f - Sell: \x0307${:,.2f}\x0f".format(data["USD"]["buy"], \ + data["USD"]["sell"]) + }, + "mtgox": { + "api_url": "https://mtgox.com/api/1/BTCUSD/ticker", + "func": lambda data: u"MtGox // Current: \x0307{}\x0f - High: \x0307{}\x0f - Low: \x0307{}\x0f - Best Ask: \x0307{}\x0f - Volume: {}".format(data['return']['last']['display'], \ + data['return']['high']['display'], data['return']['low']['display'], data['return']['buy']['display'], \ + data['return']['vol']['display']) + }, + "coinbase":{ + "api_url": "https://coinbase.com/api/v1/prices/spot_rate", + "func": lambda data: u"Coinbase // Current: \x0307${:,.2f}\x0f".format(float(data['amount'])) + }, + "bitpay": { + "api_url": "https://bitpay.com/api/rates", + "func": lambda data: u"Bitpay // Current: \x0307${:,.2f}\x0f".format(data[0]['rate']) + }, + "bitstamp": { + "api_url": "https://www.bitstamp.net/api/ticker/", + "func": lambda data: u"BitStamp // Current: \x0307${:,.2f}\x0f - High: \x0307${:,.2f}\x0f - Low: \x0307${:,.2f}\x0f - Volume: {:,.2f} BTC".format(float(data['last']), float(data['high']), float(data['low']), \ + float(data['volume'])) + } +} + + +## HOOK FUNCTIONS -@hook.command("butt", autohelp=False) @hook.command("btc", autohelp=False) @hook.command(autohelp=False) def bitcoin(inp): - "bitcoin -- Gets current exchange rate for bitcoins from several exchanges, default is Blockchain. Supports MtGox, Bitpay, Coinbase and BitStamp." - exchanges = { - "blockchain": { - "api_url": "https://blockchain.info/ticker", - "func": lambda data: u"Blockchain // Buy: \x0307${:,.2f}\x0f - Sell: \x0307${:,.2f}\x0f".format(data["USD"]["buy"], \ - data["USD"]["sell"]) - }, - "mtgox": { - "api_url": "https://mtgox.com/api/1/BTCUSD/ticker", - "func": lambda data: u"MtGox // Current: \x0307{}\x0f - High: \x0307{}\x0f - Low: \x0307{}\x0f - Best Ask: \x0307{}\x0f - Volume: {}".format(data['return']['last']['display'], \ - data['return']['high']['display'], data['return']['low']['display'], data['return']['buy']['display'], \ - data['return']['vol']['display']) - }, - "coinbase":{ - "api_url": "https://coinbase.com/api/v1/prices/spot_rate", - "func": lambda data: u"Coinbase // Current: \x0307${:,.2f}\x0f".format(float(data['amount'])) - }, - "bitpay": { - "api_url": "https://bitpay.com/api/rates", - "func": lambda data: u"Bitpay // Current: \x0307${:,.2f}\x0f".format(data[0]['rate']) - }, - "bitstamp": { - "api_url": "https://www.bitstamp.net/api/ticker/", - "func": lambda data: u"BitStamp // Current: \x0307${:,.2f}\x0f - High: \x0307${:,.2f}\x0f - Low: \x0307${:,.2f}\x0f - Volume: {:,.2f} BTC".format(float(data['last']), float(data['high']), float(data['low']), \ - float(data['volume'])) - } - } - + """bitcoin -- Gets current exchange rate for bitcoins from several exchanges, default is Blockchain. Supports MtGox, Bitpay, Coinbase and BitStamp.""" inp = inp.lower() if inp: @@ -48,6 +51,7 @@ def bitcoin(inp): return func(data) +@hook.command("ltc", autohelp=False) @hook.command(autohelp=False) def litecoin(inp, message=None): """litecoin -- gets current exchange rate for litecoins from BTC-E""" From 8b8623eb9e5f78b4ee3fcedfa4a500793bb11356 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Tue, 3 Dec 2013 22:54:38 +1300 Subject: [PATCH 7/9] I fix, you tube? --- plugins/youtube.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/youtube.py b/plugins/youtube.py index aa93640..664c3b6 100644 --- a/plugins/youtube.py +++ b/plugins/youtube.py @@ -74,13 +74,13 @@ def get_video_description(video_id): data = request['data'] - out = '\x02{}\x02'.format(data['title']) + out = u'\x02{}\x02'.format(data['title']) if not data.get('duration'): return out length = data['duration'] - out += ' - length \x02{}\x02'.format(format_time(length, simple=True)) + out += u' - length \x02{}\x02'.format(format_time(length, simple=True)) if 'ratingCount' in data: # format @@ -88,12 +88,12 @@ def get_video_description(video_id): dislikes = plural(data['ratingCount'] - int(data['likeCount']), "dislike") percent = 100 * float(data['likeCount'])/float(data['ratingCount']) - out += ' - {}, {} (\x02{:.1f}\x02%)'.format(likes, + out += u' - {}, {} (\x02{:.1f}\x02%)'.format(likes, dislikes, percent) if 'viewCount' in data: views = data['viewCount'] - out += ' - \x02{:,}\x02 view{}'.format(views, "s"[views==1:]) + out += u' - \x02{:,}\x02 view{}'.format(views, "s"[views==1:]) try: uploader = http.get_json(base_url + "users/{}?alt=json".format(data["uploader"]))["entry"]["author"][0]["name"]["$t"] @@ -101,11 +101,11 @@ def get_video_description(video_id): uploader = data["uploader"] upload_time = time.strptime(data['uploaded'], "%Y-%m-%dT%H:%M:%S.000Z") - out += ' - \x02{}\x02 on \x02{}\x02'.format(uploader, + out += u' - \x02{}\x02 on \x02{}\x02'.format(uploader, time.strftime("%Y.%m.%d", upload_time)) if 'contentRating' in data: - out += ' - \x034NSFW\x02' + out += u' - \x034NSFW\x02' return out @@ -115,6 +115,7 @@ def youtube_url(match): return get_video_description(match.group(1)) +@hook.command('you') @hook.command('yt') @hook.command('y') @hook.command @@ -130,7 +131,7 @@ def youtube(inp): video_id = request['data']['items'][0]['id'] - return get_video_description(video_id) + " - " + video_url % video_id + return get_video_description(video_id) + u" - " + video_url % video_id From fdbcb967bb80290fa8a1bc48e6c2d065fa7ce233 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Wed, 4 Dec 2013 14:12:50 +1300 Subject: [PATCH 8/9] totally removed karma --- plugins/karma.py | 134 ----------------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 plugins/karma.py diff --git a/plugins/karma.py b/plugins/karma.py deleted file mode 100644 index 2a48682..0000000 --- a/plugins/karma.py +++ /dev/null @@ -1,134 +0,0 @@ -from util import hook, timesince - -import time -import re - -db_ready = False - -CAN_DOWNVOTE = False - - -def db_init(db): - db.execute("""CREATE TABLE if not exists karma( - nick_vote TEXT PRIMARY KEY, - up_karma INTEGER, - down_karma INTEGER, - total_karma INTEGER)""") - - db.execute("""CREATE TABLE if not exists karma_voters( - voter TEXT, - votee TEXT, - epoch FLOAT, - PRIMARY KEY(voter, votee))""") - db_ready = True - - -def up(db, nick_vote): - db.execute("""UPDATE karma SET - up_karma = up_karma + 1, - total_karma = total_karma + 1 WHERE nick_vote=?""", (nick_vote.lower(),)) - db.commit() - - -def down(db, nick_vote): - db.execute("""UPDATE karma SET - down_karma = down_karma + 1, - total_karma = total_karma + 1 WHERE nick_vote=?""", (nick_vote.lower(),)) - db.commit() - - -def allowed(db, nick, nick_vote): - time_restriction = 3600 - db.execute("""DELETE FROM karma_voters WHERE ? - epoch >= 3600""", - (time.time(),)) - db.commit() - check = db.execute("""SELECT epoch FROM karma_voters WHERE voter=? AND votee=?""", - (nick.lower(), nick_vote.lower())).fetchone() - - if check: - check = check[0] - if time.time() - check >= time_restriction: - db.execute("""INSERT OR REPLACE INTO karma_voters( - voter, - votee, - epoch) values(?,?,?)""", (nick.lower(), nick_vote.lower(), time.time())) - db.commit() - return True, 0 - else: - return False, timesince.timeuntil(check, now=time.time() - time_restriction) - else: - db.execute("""INSERT OR REPLACE INTO karma_voters( - voter, - votee, - epoch) values(?,?,?)""", (nick.lower(), nick_vote.lower(), time.time())) - db.commit() - return True, 0 - - -# TODO Make this work on multiple matches in a string, right now it'll only -# work on one match. -# karma_re = ('((\S+)(\+\+|\-\-))+', re.I) -karma_re = ('(.+)(\+\+|\-\-)$', re.I) - - -@hook.regex(*karma_re) -def karma_add(match, nick='', chan='', db=None, notice=None): - - if not db_ready: - db_init(db) - - nick_vote = match.group(1).strip().replace("+", "") - if nick.lower() == nick_vote.lower(): - notice("You can't vote on yourself!") - return - if len(nick_vote) < 3 or " " in nick_vote: - return # ignore anything below 3 chars in length or with spaces - - vote_allowed, when = allowed(db, nick, nick_vote) - if vote_allowed: - if match.group(2) == '++': - db.execute("""INSERT or IGNORE INTO karma( - nick_vote, - up_karma, - down_karma, - total_karma) values(?,?,?,?)""", (nick_vote.lower(), 0, 0, 0)) - up(db, nick_vote) - notice("Gave {} 1 karma!".format(nick_vote)) - if match.group(2) == '--' and CAN_DOWNVOTE: - db.execute("""INSERT or IGNORE INTO karma( - nick_vote, - up_karma, - down_karma, - total_karma) values(?,?,?,?)""", (nick_vote.lower(), 0, 0, 0)) - down(db, nick_vote) - notice("Took away 1 karma from {}.".format(nick_vote)) - else: - return - else: - notice("You are trying to vote too often. You can vote again in {}!".format(when)) - - return - - -@hook.command('k') -@hook.command -def karma(inp, nick='', chan='', db=None): - """k/karma -- returns karma stats for """ - - if not db_ready: - db_init(db) - - if not chan.startswith('#'): - return - - nick_vote = inp - out = db.execute("""SELECT * FROM karma WHERE nick_vote=?""", - (nick_vote.lower(),)).fetchall() - - if not out: - return "That user has no karma." - else: - out = out[0] - return "{} has {} karma points.".format(nick_vote, out[1] - out[2]) - - return From b65e6e5a75d8fb1969f6ff09333376da97d5d4f1 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Wed, 11 Dec 2013 17:11:34 +1300 Subject: [PATCH 9/9] Don't show URL if it just parsed a URL --- plugins/newegg.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/newegg.py b/plugins/newegg.py index 1f02cf5..bd07a47 100644 --- a/plugins/newegg.py +++ b/plugins/newegg.py @@ -10,7 +10,7 @@ API_SEARCH = "http://www.ows.newegg.com/Search.egg/Advanced" NEWEGG_RE = (r"(?:(?:www.newegg.com|newegg.com)/Product/Product\.aspx\?Item=)([-_a-zA-Z0-9]+)", re.I) -def format_item(item): +def format_item(item, show_url=True): """ takes a newegg API item object and returns a description """ title = text.truncate_str(item["Title"], 50) @@ -45,11 +45,14 @@ def format_item(item): # join all the tags together in a comma seperated string ("tag1, tag2, tag3") tag_text = u", ".join(tags) - # create the item URL and shorten it - url = web.try_isgd(ITEM_URL.format(item["NeweggItemNumber"])) - - return u"\x02{}\x02 ({}) - {} - {} - {}".format(title, price, rating, - tag_text, url) + if show_url: + # create the item URL and shorten it + url = web.try_isgd(ITEM_URL.format(item["NeweggItemNumber"])) + return u"\x02{}\x02 ({}) - {} - {} - {}".format(title, price, rating, + tag_text, url) + else: + return u"\x02{}\x02 ({}) - {} - {}".format(title, price, rating, + tag_text) ## HOOK FUNCTIONS @@ -58,7 +61,7 @@ def format_item(item): def newegg_url(match): item_id = match.group(1) item = http.get_json(API_PRODUCT.format(item_id)) - return format_item(item) + return format_item(item, show_url=False) @hook.command