From 22b6392cc88c0425aa9da3a6ca557207eb10f6c7 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Fri, 8 Aug 2014 18:30:39 +0200 Subject: [PATCH] Alias module: can create of aliases; fixes #27 --- modules/alias.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/alias.py b/modules/alias.py index cd5eb5e..7edd95b 100644 --- a/modules/alias.py +++ b/modules/alias.py @@ -154,17 +154,23 @@ def treat_variables(res): return True def treat_alias(msg, hooks_cache): - if msg.cmd == "PRIVMSG" and len(msg.cmds) > 0 and (len(msg.cmds[0]) > 0 - and msg.cmds[0][0] == "!" - and msg.cmds[0][1:] in DATAS.getNode("aliases").index - and msg.cmds[0][1:] not in hooks_cache("cmd_hook")): - msg.content = msg.content.replace(msg.cmds[0], - DATAS.getNode("aliases").index[msg.cmds[0][1:]]["origin"], 1) + if msg.cmd == "PRIVMSG": + if len(msg.cmds) > 0 and (len(msg.cmds[0]) > 0 + and msg.cmds[0][0] == "!" + and msg.cmds[0][1:] in DATAS.getNode("aliases").index + and msg.cmds[0][1:] not in hooks_cache("cmd_hook")): + msg.content = msg.content.replace(msg.cmds[0], + DATAS.getNode("aliases").index[msg.cmds[0][1:]]["origin"], 1) - msg.content = replace_variables(msg.content, msg) + msg.parse_content() - msg.parse_content() - return True + treat_alias(msg, hooks_cache) + return True + + else: + msg.content = replace_variables(msg.content, msg) + msg.parse_content() + return False return False