Translation module: allow only translation to or from english (due to wordreference restrinctions)
This commit is contained in:
parent
5bec50744c
commit
eccf4ddf7a
@ -42,8 +42,10 @@ def cmd_translate(msg):
|
|||||||
if len(msg.cmds) < 2:
|
if len(msg.cmds) < 2:
|
||||||
raise IRCException("which word would you translate?")
|
raise IRCException("which word would you translate?")
|
||||||
|
|
||||||
if len(msg.cmds) > 3 and msg.cmds[1] == "en" and msg.cmds[2] in LANG:
|
if len(msg.cmds) > 3 and msg.cmds[1] in LANG and msg.cmds[2] in LANG:
|
||||||
langFrom = "en"
|
if msg.cmds[1] != "en" and msg.cmds[2] != "en":
|
||||||
|
raise IRCException("sorry, I can only translate to or from english")
|
||||||
|
langFrom = msg.cmds[1]
|
||||||
langTo = msg.cmds[2]
|
langTo = msg.cmds[2]
|
||||||
term = ' '.join(msg.cmds[3:])
|
term = ' '.join(msg.cmds[3:])
|
||||||
elif len(msg.cmds) > 2 and msg.cmds[1] in LANG:
|
elif len(msg.cmds) > 2 and msg.cmds[1] in LANG:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user