return command (in case resolved alias) from _find_command_hook()

This commit is contained in:
jesopo 2019-09-12 21:53:35 +01:00
parent 2d7a192a6c
commit 04489ce90a

View file

@ -93,7 +93,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 None, None return None, None, None
hook = None hook = None
channel_skip = False channel_skip = False
@ -124,7 +124,7 @@ class Module(ModuleManager.BaseModule):
if not hook and (private_skip or channel_skip): if not hook and (private_skip or channel_skip):
raise BadContextException("channel" if channel_skip else "private") raise BadContextException("channel" if channel_skip else "private")
return hook, args_split return hook, command, args_split
def _check(self, context, kwargs, requests=[]): def _check(self, context, kwargs, requests=[]):
event_hook = self.events.on(context).on("command") event_hook = self.events.on(context).on("command")
@ -281,8 +281,8 @@ class Module(ModuleManager.BaseModule):
return return
try: try:
hook, args_split = self._find_command_hook(event["server"], hook, command, args_split = self._find_command_hook(
command, True, args_split) event["server"], command, True, args_split)
except BadContextException: except BadContextException:
event["channel"].send_message( event["channel"].send_message(
"%s: That command is not valid in a channel" % "%s: That command is not valid in a channel" %
@ -333,8 +333,8 @@ class Module(ModuleManager.BaseModule):
args_split = event["message_split"][1:] args_split = event["message_split"][1:]
try: try:
hook, args_split = self._find_command_hook(event["server"], hook, command, args_split = self._find_command_hook(
command, False, args_split) event["server"], command, False, args_split)
except BadContextException: except BadContextException:
event["user"].send_message( event["user"].send_message(
"That command is not valid in a PM") "That command is not valid in a PM")