alias: only perform alias expansion on Command
This commit is contained in:
parent
920506c702
commit
c3f2c89c7c
1 changed files with 7 additions and 7 deletions
|
@ -261,17 +261,17 @@ def cmd_unalias(msg):
|
||||||
def treat_alias(msg):
|
def treat_alias(msg):
|
||||||
if msg.cmd in context.data.getNode("aliases").index:
|
if msg.cmd in context.data.getNode("aliases").index:
|
||||||
origin = context.data.getNode("aliases").index[msg.cmd]["origin"]
|
origin = context.data.getNode("aliases").index[msg.cmd]["origin"]
|
||||||
rpl_cmd = context.subparse(msg, origin)
|
rpl_msg = context.subparse(msg, origin)
|
||||||
if isinstance(rpl_cmd, Command):
|
if isinstance(rpl_msg, Command):
|
||||||
rpl_cmd.args = replace_variables(rpl_cmd.args, msg)
|
rpl_msg.args = replace_variables(rpl_msg.args, msg)
|
||||||
rpl_cmd.args += msg.args
|
rpl_msg.args += msg.args
|
||||||
rpl_cmd.kwargs.update(msg.kwargs)
|
rpl_msg.kwargs.update(msg.kwargs)
|
||||||
elif len(msg.args) or len(msg.kwargs):
|
elif len(msg.args) or len(msg.kwargs):
|
||||||
raise IMException("This kind of alias doesn't take any argument (haven't you forgotten the '!'?).")
|
raise IMException("This kind of alias doesn't take any argument (haven't you forgotten the '!'?).")
|
||||||
|
|
||||||
# Avoid infinite recursion
|
# Avoid infinite recursion
|
||||||
if msg.cmd != rpl_cmd.cmd:
|
if not isinstance(rpl_msg, Command) or msg.cmd != rpl_msg.cmd:
|
||||||
# Also return origin message, if it can be treated as well
|
# Also return origin message, if it can be treated as well
|
||||||
return [msg, rpl_cmd]
|
return [msg, rpl_msg]
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue