diff --git a/sopel_modules/SpiceBot/Commands.py b/sopel_modules/SpiceBot/Commands.py index 46aa57d..5db001b 100644 --- a/sopel_modules/SpiceBot/Commands.py +++ b/sopel_modules/SpiceBot/Commands.py @@ -48,6 +48,17 @@ class BotCommands(): else: return False + def get_realcom(self, command, trigger_command_type): + commands_list = dict() + for commandstype in self.dict['commands'][trigger_command_type].keys(): + for com in self.dict['commands'][commandstype].keys(): + if com not in commands_list.keys(): + commands_list[com] = self.dict['commands'][commandstype][com] + realcom = command + if "aliasfor" in commands_list[command['com']].keys(): + realcom = commands_list[command['com']]["aliasfor"] + return realcom + def set_command_disabled(self, bot, command, channel, timestamp, reason, bywhom): if not len(list(self.dict['disabled'])): self.dict['disabled'] = spicedb.get_channel_value(bot, channel, 'disabled_commands', 'commands') or {} diff --git a/sopel_modules/SpiceBot/Prerun.py b/sopel_modules/SpiceBot/Prerun.py index afbf587..8728a55 100644 --- a/sopel_modules/SpiceBot/Prerun.py +++ b/sopel_modules/SpiceBot/Prerun.py @@ -32,17 +32,12 @@ class BotPrerun(): # Primary command used for trigger, and a list of all words trigger_args, trigger_command = self.trigger_args(trigger.args[1], trigger_command_type) - command_lookup = commands.find_command_type(trigger_command) - # Argsdict Defaults argsdict_default = {} argsdict_default["type"] = trigger_command_type argsdict_default["com"] = trigger_command - if command_lookup and "aliasfor" in commands.dict["commands"][command_lookup].keys(): - realcom = commands.dict["commands"][command_lookup]["aliasfor"] - else: - realcom = trigger_command + realcom = commands.get_realcom(argsdict_default["com"], trigger_command_type) argsdict_default["realcom"] = realcom # split into && groupings