tweaks
This commit is contained in:
parent
e94c607b3e
commit
cda99f1852
3 changed files with 8 additions and 4 deletions
|
@ -107,9 +107,9 @@ def format_output(data):
|
||||||
## HOOK FUNCTIONS
|
## HOOK FUNCTIONS
|
||||||
|
|
||||||
@hook.command('plugin')
|
@hook.command('plugin')
|
||||||
@hook.command
|
@hook.commands
|
||||||
def bukkitplugin(inp, reply=None, message=None):
|
def bukget(inp, reply=None, message=None):
|
||||||
"""plugin <slug/name> - Look up a plugin on dev.bukkit.org"""
|
"""bukget <slug/name> - Look up a plugin on dev.bukkit.org"""
|
||||||
# get the plugin slug using search
|
# get the plugin slug using search
|
||||||
try:
|
try:
|
||||||
slug = plugin_search(inp)
|
slug = plugin_search(inp)
|
|
@ -2,6 +2,8 @@ from util import hook, http, text, web
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
## CONSTANTS
|
||||||
|
|
||||||
ITEM_URL = "http://www.newegg.com/Product/Product.aspx?Item={}"
|
ITEM_URL = "http://www.newegg.com/Product/Product.aspx?Item={}"
|
||||||
|
|
||||||
API_PRODUCT = "http://www.ows.newegg.com/Products.egg/{}/ProductDetails"
|
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)
|
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):
|
def format_item(item, show_url=True):
|
||||||
""" takes a newegg API item object and returns a description """
|
""" takes a newegg API item object and returns a description """
|
||||||
title = text.truncate_str(item["Title"], 50)
|
title = text.truncate_str(item["Title"], 50)
|
||||||
|
|
|
@ -7,7 +7,7 @@ def format_time(seconds, count=3, accuracy=6, simple=False):
|
||||||
|
|
||||||
SIMPLE: displays the time in a simple format
|
SIMPLE: displays the time in a simple format
|
||||||
>>> format_time(SECONDS)
|
>>> format_time(SECONDS)
|
||||||
1 hour, 2 minutes, and 34 seconds
|
1 hour, 2 minutes and 34 seconds
|
||||||
>>> format_time(SECONDS, simple=True)
|
>>> format_time(SECONDS, simple=True)
|
||||||
1h 2m 34s
|
1h 2m 34s
|
||||||
|
|
||||||
|
|
Reference in a new issue