From 00a8129634b431888fe0bcdecc9e267fd5f9a732 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 17 Dec 2019 14:29:37 +0000 Subject: [PATCH] pass `user` on get.command events, so e.g. aliases know user nicknames --- src/core_modules/commands/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core_modules/commands/__init__.py b/src/core_modules/commands/__init__.py index a7b55f2b..e330e2c6 100644 --- a/src/core_modules/commands/__init__.py +++ b/src/core_modules/commands/__init__.py @@ -73,11 +73,12 @@ class Module(ModuleManager.BaseModule): server.get_setting(COMMAND_METHOD, self.bot.get_setting(COMMAND_METHOD, default))).upper() - def _find_command_hook(self, server, target, is_channel, command, args): + def _find_command_hook(self, server, target, is_channel, command, user, + args): if not self.has_command(command): command_event = CommandEvent(command, args) self.events.on("get.command").call(command=command_event, - server=server, target=target, is_channel=is_channel) + server=server, target=target, is_channel=is_channel, user=user) command = command_event.command args = command_event.args @@ -303,7 +304,8 @@ class Module(ModuleManager.BaseModule): if command: try: hook, command, args_split = self._find_command_hook( - event["server"], event["channel"], True, command, args) + event["server"], event["channel"], True, command, + event["user"], args) except BadContextException: event["channel"].send_message( "%s: That command is not valid in a channel" % @@ -361,7 +363,8 @@ class Module(ModuleManager.BaseModule): try: hook, command, args_split = self._find_command_hook( - event["server"], event["user"], False, command, args) + event["server"], event["user"], False, command, + event["user"], args) except BadContextException: event["user"].send_message( "That command is not valid in a PM")