[alias] Fix parsing error when creating a (not allowed) spaced alias

This commit is contained in:
nemunaire 2015-11-24 20:33:02 +01:00
parent ea8656ce0d
commit 6fc6561186

View File

@ -267,7 +267,9 @@ def treat_alias(msg):
def parseask(msg):
if re.match(".*(register|set|cr[ée]{2}|new|nouvel(le)?) alias.*", msg.text) is not None:
result = re.match(".*alias !?([^ ]+) ?(pour|for|=|:) ?(.+)$", msg.text)
if result.group(1) in context.data.getNode("aliases").index:
if result is None:
raise IMException("Something is wrong with your alias definition. Hint: spaces are not allowed.")
elif result.group(1) in context.data.getNode("aliases").index:
raise IMException("this alias is already defined.")
else:
create_alias(result.group(1),