From 1078f12770913f979312ab793cbd6f3e95fbd1de Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Thu, 17 May 2012 07:47:49 +1200 Subject: [PATCH] Cleaned up mcitems a bit --- plugins/mcitems.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/plugins/mcitems.py b/plugins/mcitems.py index 123be50..516a26b 100755 --- a/plugins/mcitems.py +++ b/plugins/mcitems.py @@ -67,9 +67,8 @@ def mcitem(input, reply=None): elif input in name.lower(): results.append("\x02[%s]\x02 %s" % (id, name)) - if not len(results): - reply("No matches found.") - return + if not results: + return "No matches found." if len(results) > 12: reply("There are too many options, please narrow your search. " \ @@ -87,15 +86,11 @@ def mcrecipe(input, reply=None): "mcrecipe -- gets the crafting recipe for an item" input = input.lower().strip() - results = [] + results = [recipe.line for recipe in recipelist + if input in recipe.output] - for recipe in recipelist: - if input in recipe.output: - results.append(recipe.line) - - if not len(results): - reply("No matches found.") - return + if not results: + return "No matches found." if len(results) > 3: reply("There are too many options, please narrow your search. " \