Get all hooks when checking command hooks, not just the first (commands.py)
This commit is contained in:
parent
8a832b7230
commit
64d12e3415
1 changed files with 4 additions and 5 deletions
|
@ -103,9 +103,9 @@ class Module(ModuleManager.BaseModule):
|
||||||
def has_command(self, command):
|
def has_command(self, command):
|
||||||
return command.lower() in self.events.on("received").on(
|
return command.lower() in self.events.on("received").on(
|
||||||
"command").get_children()
|
"command").get_children()
|
||||||
def get_hook(self, command):
|
def get_hooks(self, command):
|
||||||
return self.events.on("received.command").on(command
|
return self.events.on("received.command").on(command
|
||||||
).get_hooks()[0]
|
).get_hooks()
|
||||||
|
|
||||||
def is_highlight(self, server, s):
|
def is_highlight(self, server, s):
|
||||||
if s and s[-1] in [":", ","]:
|
if s and s[-1] in [":", ","]:
|
||||||
|
@ -142,12 +142,11 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
hook = None
|
hook = None
|
||||||
target = None
|
target = None
|
||||||
for potential_hook in self.get_hook(command):
|
for potential_hook in self.get_hooks(command):
|
||||||
hook = self.get_hook(command)
|
|
||||||
alias_of = self._get_alias_of(hook)
|
alias_of = self._get_alias_of(hook)
|
||||||
if alias_of:
|
if alias_of:
|
||||||
if self.has_command(alias_of):
|
if self.has_command(alias_of):
|
||||||
hook = self.get_hook(alias_of)
|
hook = self.get_hooks(alias_of)[0]
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"'%s' is an alias of unknown command '%s'"
|
"'%s' is an alias of unknown command '%s'"
|
||||||
|
|
Loading…
Reference in a new issue