This commit is contained in:
Luke Rogers 2013-12-11 17:31:57 +13:00
parent e94c607b3e
commit cda99f1852
3 changed files with 8 additions and 4 deletions

View File

@ -107,9 +107,9 @@ def format_output(data):
## HOOK FUNCTIONS
@hook.command('plugin')
@hook.command
def bukkitplugin(inp, reply=None, message=None):
"""plugin <slug/name> - Look up a plugin on dev.bukkit.org"""
@hook.commands
def bukget(inp, reply=None, message=None):
"""bukget <slug/name> - Look up a plugin on dev.bukkit.org"""
# get the plugin slug using search
try:
slug = plugin_search(inp)

View File

@ -2,6 +2,8 @@ from util import hook, http, text, web
import json
import re
## CONSTANTS
ITEM_URL = "http://www.newegg.com/Product/Product.aspx?Item={}"
API_PRODUCT = "http://www.ows.newegg.com/Products.egg/{}/ProductDetails"
@ -10,6 +12,8 @@ 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)
## OTHER FUNCTIONS
def format_item(item, show_url=True):
""" takes a newegg API item object and returns a description """
title = text.truncate_str(item["Title"], 50)

View File

@ -7,7 +7,7 @@ def format_time(seconds, count=3, accuracy=6, simple=False):
SIMPLE: displays the time in a simple format
>>> format_time(SECONDS)
1 hour, 2 minutes, and 34 seconds
1 hour, 2 minutes and 34 seconds
>>> format_time(SECONDS, simple=True)
1h 2m 34s