From 046d9f7be0f0fc48c14086ae626d63d7aa48e99f Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 25 Jun 2019 12:32:49 -0400 Subject: [PATCH] test --- sopel_modules/SpiceBot/Commands.py | 12 +++++++----- sopel_modules/SpiceBot/Prerun.py | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sopel_modules/SpiceBot/Commands.py b/sopel_modules/SpiceBot/Commands.py index 092f526..3271c45 100644 --- a/sopel_modules/SpiceBot/Commands.py +++ b/sopel_modules/SpiceBot/Commands.py @@ -58,11 +58,13 @@ class BotCommands(): self.dict['nickrules'].append(command) def find_command_type(self, command): - for commandstype in list(self.dict['commands'].keys()): - if commandstype not in ['rule']: - for com in list(self.dict['commands'][commandstype].keys()): - if com.lower() == command.lower(): - return commandstype + commandtype_list = list(self.dict['commands'].keys()) + if 'rule' in commandtype_list: + commandtype_list.remove('rule') + for commandstype in commandtype_list: + for com in list(self.dict['commands'][commandstype].keys()): + if com.lower() == command.lower(): + return commandstype return None def get_commands_disabled(self, channel): diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index 35bff14..cde81b3 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -28,9 +28,11 @@ def prerun(t_command_type='module'): # Primary command used for trigger, and a list of all words trigger_args, trigger_command = make_trigger_args(trigger.args[1], trigger_command_type) + bot.say(str(trigger_command_type)) trigger_command_type = botcommands.find_command_type(trigger_command) if not trigger_command_type: return + bot.say(str(trigger_command_type)) for comtype in [trigger_command_type, t_command_type]: