take/return args_split from _find_command_hook, for alias replacing
This commit is contained in:
parent
2ff21f5f78
commit
c9b9827c14
1 changed files with 11 additions and 7 deletions
|
@ -90,7 +90,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _find_command_hook(self, server, command, is_channel):
|
def _find_command_hook(self, server, command, is_channel, args_split):
|
||||||
if not self.has_command(command):
|
if not self.has_command(command):
|
||||||
aliases = self._get_aliases(server)
|
aliases = self._get_aliases(server)
|
||||||
if command.lower() in aliases:
|
if command.lower() in aliases:
|
||||||
|
@ -99,7 +99,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
try:
|
try:
|
||||||
args_split = self._alias_arg_replace(new_args, args_split)
|
args_split = self._alias_arg_replace(new_args, args_split)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return
|
return None, None
|
||||||
|
|
||||||
hook = None
|
hook = None
|
||||||
if self.has_command(command):
|
if self.has_command(command):
|
||||||
|
@ -121,7 +121,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
hook = potential_hook
|
hook = potential_hook
|
||||||
break
|
break
|
||||||
|
|
||||||
return hook
|
return hook, args_split
|
||||||
|
|
||||||
def command(self, server, target, is_channel, user, command, args_split,
|
def command(self, server, target, is_channel, user, command, args_split,
|
||||||
tags, statusmsg, hook, **kwargs):
|
tags, statusmsg, hook, **kwargs):
|
||||||
|
@ -226,7 +226,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
args_split = event["message_split"][2:]
|
args_split = event["message_split"][2:]
|
||||||
|
|
||||||
if command:
|
if command:
|
||||||
hook = self._find_command_hook(event["server"], command, True)
|
hook, args_split = self._find_command_hook(event["server"], command,
|
||||||
|
True)
|
||||||
if hook:
|
if hook:
|
||||||
self.command(event["server"], event["channel"], True,
|
self.command(event["server"], event["channel"], True,
|
||||||
event["user"], command, args_split, event["tags"],
|
event["user"], command, args_split, event["tags"],
|
||||||
|
@ -255,11 +256,14 @@ class Module(ModuleManager.BaseModule):
|
||||||
def private_message(self, event):
|
def private_message(self, event):
|
||||||
if event["message_split"] and not event["action"]:
|
if event["message_split"] and not event["action"]:
|
||||||
command = event["message_split"][0].lower()
|
command = event["message_split"][0].lower()
|
||||||
hook = self._find_command_hook(event["server"], command, False)
|
args_split = event["message_split"][1:]
|
||||||
|
|
||||||
|
hook, args_split = self._find_command_hook(event["server"], command,
|
||||||
|
False)
|
||||||
|
|
||||||
if hook:
|
if hook:
|
||||||
self.command(event["server"], event["user"], False,
|
self.command(event["server"], event["user"], False,
|
||||||
event["user"], command, event["message_split"][1:],
|
event["user"], command, args_split, event["tags"], "", hook)
|
||||||
event["tags"], "", hook)
|
|
||||||
event["user"].buffer.skip_next()
|
event["user"].buffer.skip_next()
|
||||||
|
|
||||||
def _get_help(self, hook):
|
def _get_help(self, hook):
|
||||||
|
|
Loading…
Reference in a new issue