From c9b9827c14acc70fb0751aad8bf33db1e2bd8802 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 20 May 2019 06:39:58 +0100 Subject: [PATCH] take/return args_split from _find_command_hook, for alias replacing --- modules/commands/__init__.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/commands/__init__.py b/modules/commands/__init__.py index 273cf6dc..da07a4e4 100644 --- a/modules/commands/__init__.py +++ b/modules/commands/__init__.py @@ -90,7 +90,7 @@ class Module(ModuleManager.BaseModule): return True 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): aliases = self._get_aliases(server) if command.lower() in aliases: @@ -99,7 +99,7 @@ class Module(ModuleManager.BaseModule): try: args_split = self._alias_arg_replace(new_args, args_split) except IndexError: - return + return None, None hook = None if self.has_command(command): @@ -121,7 +121,7 @@ class Module(ModuleManager.BaseModule): hook = potential_hook break - return hook + return hook, args_split def command(self, server, target, is_channel, user, command, args_split, tags, statusmsg, hook, **kwargs): @@ -226,7 +226,8 @@ class Module(ModuleManager.BaseModule): args_split = event["message_split"][2:] if command: - hook = self._find_command_hook(event["server"], command, True) + hook, args_split = self._find_command_hook(event["server"], command, + True) if hook: self.command(event["server"], event["channel"], True, event["user"], command, args_split, event["tags"], @@ -255,11 +256,14 @@ class Module(ModuleManager.BaseModule): def private_message(self, event): if event["message_split"] and not event["action"]: 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: self.command(event["server"], event["user"], False, - event["user"], command, event["message_split"][1:], - event["tags"], "", hook) + event["user"], command, args_split, event["tags"], "", hook) event["user"].buffer.skip_next() def _get_help(self, hook):