Cleaned up mcitems a bit

This commit is contained in:
Luke Rogers 2012-05-17 07:47:49 +12:00
parent ace1743891
commit 1078f12770

View file

@ -67,9 +67,8 @@ def mcitem(input, reply=None):
elif input in name.lower(): elif input in name.lower():
results.append("\x02[%s]\x02 %s" % (id, name)) results.append("\x02[%s]\x02 %s" % (id, name))
if not len(results): if not results:
reply("No matches found.") return "No matches found."
return
if len(results) > 12: if len(results) > 12:
reply("There are too many options, please narrow your search. " \ reply("There are too many options, please narrow your search. " \
@ -87,15 +86,11 @@ def mcrecipe(input, reply=None):
"mcrecipe <item> -- gets the crafting recipe for an item" "mcrecipe <item> -- gets the crafting recipe for an item"
input = input.lower().strip() input = input.lower().strip()
results = [] results = [recipe.line for recipe in recipelist
if input in recipe.output]
for recipe in recipelist: if not results:
if input in recipe.output: return "No matches found."
results.append(recipe.line)
if not len(results):
reply("No matches found.")
return
if len(results) > 3: if len(results) > 3:
reply("There are too many options, please narrow your search. " \ reply("There are too many options, please narrow your search. " \