From ff7ed67bbabd6245288b7cc9a35ac323501d9233 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Mon, 13 May 2019 10:17:21 -0400 Subject: [PATCH] debug --- .../SpiceBot_CommandsQuery/QueryCommand.py | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py b/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py index f8da999..727783e 100644 --- a/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py +++ b/sopel_modules/SpiceBot_CommandsQuery/QueryCommand.py @@ -21,18 +21,23 @@ def query_detection(bot, trigger): commands_list = dict() for commandstype in bot.memory['SpiceBot_CommandsQuery']['commands'].keys(): - # if commandstype != 'rule': - for com in bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype].keys(): - if com not in commands_list.keys(): - if commandstype == 'nickname': - commands_list[str(bot.nick) + " " + com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com] - else: - commands_list[com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com] + if commandstype != 'rule': + for com in bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype].keys(): + if com not in commands_list.keys(): + if commandstype == 'nickname': + commands_list[str(bot.nick) + " " + com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com] + else: + commands_list[com] = bot.memory['SpiceBot_CommandsQuery']['commands'][commandstype][com] triggerargsarray = spicemanip.main(trigger, 'create') # command issued, check if valid - querycommand = spicemanip.main(triggerargsarray, 1).lower()[1:] + querycommand = spicemanip.main(triggerargsarray, 1).lower()[1:] or None + if not querycommand: + return + bot.say(str(querycommand)) + bot.say("no querycommand") + if len(querycommand) == 1: commandlist = [] for command in commands_list.keys(): @@ -45,7 +50,7 @@ def query_detection(bot, trigger): bot.notice("The following commands match " + str(querycommand) + ": " + spicemanip.main(commandlist, 'andlist') + ".", trigger.nick) return - elif querycommand.endswith(tuple(["+"])): + elif querycommand.endswith("+"): querycommand = querycommand[:-1] if querycommand not in commands_list.keys(): bot.notice("The " + str(querycommand) + " does not appear to be valid.") @@ -57,7 +62,7 @@ def query_detection(bot, trigger): bot.notice("The following commands match " + str(querycommand) + ": " + spicemanip.main(validcomlist, 'andlist') + ".", trigger.nick) return - elif querycommand.endswith(tuple(['?'])): + elif querycommand.endswith('?'): querycommand = querycommand[:-1] sim_com, sim_num = [], [] for com in commands_list.keys(): @@ -78,9 +83,6 @@ def query_detection(bot, trigger): bot.notice("The following commands match " + str(querycommand) + ": " + str(querycommand) + ".", trigger.nick) return - elif not querycommand: - return - else: commandlist = [] for command in commands_list.keys():