From 64d12e3415cd87a5a190142759372c5a045a505c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 30 Jan 2019 11:23:17 +0000 Subject: [PATCH] Get all hooks when checking command hooks, not just the first (commands.py) --- modules/commands.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/commands.py b/modules/commands.py index db65250f..f98f4a52 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -103,9 +103,9 @@ class Module(ModuleManager.BaseModule): def has_command(self, command): return command.lower() in self.events.on("received").on( "command").get_children() - def get_hook(self, command): + def get_hooks(self, command): return self.events.on("received.command").on(command - ).get_hooks()[0] + ).get_hooks() def is_highlight(self, server, s): if s and s[-1] in [":", ","]: @@ -142,12 +142,11 @@ class Module(ModuleManager.BaseModule): hook = None target = None - for potential_hook in self.get_hook(command): - hook = self.get_hook(command) + for potential_hook in self.get_hooks(command): alias_of = self._get_alias_of(hook) if alias_of: if self.has_command(alias_of): - hook = self.get_hook(alias_of) + hook = self.get_hooks(alias_of)[0] else: raise ValueError( "'%s' is an alias of unknown command '%s'"