Alias module: can create of aliases; fixes #27

This commit is contained in:
nemunaire 2014-08-08 18:30:39 +02:00
parent 1e139b3afa
commit 22b6392cc8

View File

@ -154,17 +154,23 @@ def treat_variables(res):
return True return True
def treat_alias(msg, hooks_cache): def treat_alias(msg, hooks_cache):
if msg.cmd == "PRIVMSG" and len(msg.cmds) > 0 and (len(msg.cmds[0]) > 0 if msg.cmd == "PRIVMSG":
and msg.cmds[0][0] == "!" if len(msg.cmds) > 0 and (len(msg.cmds[0]) > 0
and msg.cmds[0][1:] in DATAS.getNode("aliases").index and msg.cmds[0][0] == "!"
and msg.cmds[0][1:] not in hooks_cache("cmd_hook")): and msg.cmds[0][1:] in DATAS.getNode("aliases").index
msg.content = msg.content.replace(msg.cmds[0], and msg.cmds[0][1:] not in hooks_cache("cmd_hook")):
DATAS.getNode("aliases").index[msg.cmds[0][1:]]["origin"], 1) 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() treat_alias(msg, hooks_cache)
return True return True
else:
msg.content = replace_variables(msg.content, msg)
msg.parse_content()
return False
return False return False